Hacking with Swift+ delivers high-quality tutorials for subscribers, with each tutorial coming as a 4K Ultra HD video and in text form so you can read or watch – whatever works best for you.
So, you can get this full video and article as well as all other subscriber-only tutorials and all future tutorials – all by subscribing to Hacking with Swift+ today.
Phantom types are a powerful way to give the Swift compiler extra information about our code so that it can stop us from making mistakes. In this article I’m going to explain how they work and why you’d want them, as well as providing lots of hands-on examples you can try.
While I’m sure you’re keen to get started programming immediately, please give me a few minutes to outline the goals of this course and explain why it’s different from other courses I’ve written.
In this article you’ll learn how memoization can dramatically boost the performance of slow functions, and how easy Swift makes it thanks to its generics and closures.
Trees are an extraordinarily simple, extraordinarily useful data type, and in this article we’ll make a complete tree data type using Swift in just a few minutes. But rather than just stop there, we’re going to do something quite beautiful that I hope will blow your mind while teaching you something useful.
In this article I’m going to walk you through building a
WaveView with SwiftUI, allowing us to create beautiful waveform-like effects to bring your user interface to life.
Assertions allow us to have Swift silently check the state of our program at runtime, but if you want to get them right you need to understand some intricacies. In this article I’ll walk you through the five ways we can make assertions in Swift, and provide clear advice on which to use and when.
The flood fill approach to path finding is one of the easiest to learn, works great in games with small maps, and is also commonly used in software – filling a picture with color, for example. In this article I’ll walk you through how the algorithm works, and help you build a visual representation of it in action.
Swift’s optionals are implemented as simple enums, with just a little compiler magic sprinkled around as syntactic sugar. However, they do much more than people realize, and in this article I’m going to demonstrate some of their power features that can really help you write better code – and blow your mind along the way.
UserDefaults system lets us store small amounts of user data for our app, which might sound simple but it’s deceptively powerful. In this article I’ll show you the correct way to create initial preferences, how to share preferences across applications, how to synchronize data with iCloud, and why this is a case where property wrappers probably aren’t a good solution.
Although apps can live in the background for quite a while, eventually they will be terminated. But when a user relaunches them, it’s a good idea to bring them roughly back to where they were, and with state restoration we can do just that.
Now that we’ve covered stacks and linked lists, queues and deques ought to be easier. In this article we’ll build both data structures in just a few lines of Swift, then explore interesting additions such as
If you have nice, clean JSON then using Swift and
Codable is like a dream come true. But what if you have messy JSON, or JSON where you really don’t know what you’ll receive ahead of time? In this article I’ll show you how to handle any kind of JSON in an elegant way, without relying on third-party libraries.
If there’s one data structure they just love teaching you at school, it’s linked lists. In this article we’re going to look at why linked lists are so appealing, walk through how to build a linked list with Swift, and look at an alternative approach using enums.
Line charts come in a couple of different forms, but they share the same goal of visualizing a change of value over time. In this article we’ll look at building a customizable line chart from scratch in SwiftUI.
I already introduced how the internals of optionals work, including how they use conditional conformance and how to avoid infinitely sized structs. In this video I’m going to go further as we look at how our knowledge of
Optional can be translated to
Result, why it’s so important that optionals are functors and monads, and more.
Arrays and sets have their own advantages and disadvantages, but what if we could combine them both to make an ordered set? We can! And in this article that’s exactly what we’ll do.
Although we mostly prefer JSON for data transfer, many major languages make it easy to parse and traverse XML documents. Swift does not, but that’s something we can fix in under a 100 lines of code by writing our own implementation of MiniDOM – Python’s lightweight implementation of the document object model.
Anyone can write Swift code to fetch network data, but much harder is knowing how to write code to do it respectfully. In this article we’ll look at building a considerate network stack, taking into account the user’s connection, preferences, and more.
Now that item editing works well, we can add a screen to edit projects. But before we can even think about that we need to add a custom section header to let users select a project to edit.
Link copied to your pasteboard.