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.
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.
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.
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.
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.
There are many data structures in computing, but stacks are one of the most fundamental – they get used in so many places, often without us even realizing. Helpfully, they are also one of the easiest types to learn, which makes them a great starting point for this new series on data structures.
Many coding problems are designed to perform the same operation on lots of data, and in fact they are so common Apple has a whole framework to make it better: Accelerate. In this video I’ll give you an introduction to Accelerate using practical examples so you can see just how easy it is.
Button view is actually capable of doing remarkable things if you take the time to customize it. In this video I’ll be walking you through the
ButtonStyle protocol, showing you how we can use it to make great-looking and reusable button effects.
Generics are one of the most powerful features of Swift, allowing us to write code once and reuse it in many ways. In this article we’ll explore how they work, why adding constraints actually helps us write more code, and how generics help solve one of the biggest problems in Swift.
Type erasure helps us solve difficult type system problems by purposefully discarding some information. In this article we’ll look at what the underlying problem is and how Swift solves it, and in the second part we’ll continue on to look at how we can build type erasure ourselves.
If you want your app to work well on larger devices, you need to support both a sidebar and a tab bar for your primary navigation. In this video I’ll show you how to build one simple SwiftUI component that transitions between both smoothly.
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.
In a previous article I showed you a smart, simple and safe way of fetching data from the internet using Combine. This article I want to look at how to handle multiple network requests safely, ensuring that both complete before you update your user interface.
When users scroll beyond the top of a scroll view the default behavior is to show some empty space, but many apps prefer to show a stretchy header area instead. In this article I’ll show you how to build that SwiftUI, making an image that stays fixed to the top no matter what.
Apple’s Foundation framework makes it easy for us to convert any kind of measurement into any other kind of measurement. In this article I’ll show you how to make the most of these APIs, but also why it’s so useful that they work with Swift features such as operator overloading, plus important protocols such as
It’s not hard to make a basic property wrapper, but if you want one that automatically updates the
body property like
@State you need to do some extra work. In this article I’ll show you exactly how it’s done, as we build a property wrapper capable of reading and writing documents from our app’s container.
Working with dates in software is hard, and if you don’t understand why then think about time zones, think about leap years, or think about how it’s the year 2563 in the Thai calendar. Apple gives us many tools for making them easier but they can be hard to discover, so in this article I’m going to try to provide some clear guidance for what to use and when.
Boxing allows us to wrap up a struct in a class, to make it easy to share in several places. I’ve touched on boxing briefly previously, but here I want to take the concept much further to add useful protocol conformances that really powerful up its usefulness.
Previously we looked at how to create basic button styles that unify your app’s styling efficiently. In this follow-on article we’re going to explore three completely different button styles that show off just what SwiftUI is capable of: glossy marble buttons, classic fantasy buttons, and sci-fi buttons.
In the first part of this tutorial we looked at the underlying problem that type erasure is trying to solve, and tried out Swift’s approach using
AnySequence. In this second part we’re going to adapt Swift’s own solution to get real type erasure for our own code.
Link copied to your pasteboard.