SwiftUI Weekly - Issue #129
The curated collection of links about SwiftUI. Delivered every Monday.
Sponsor
Glassfy
Simplify building, managing, and growing in-app purchases. Offload backend work and building paywalls to us. Build for free today.
Reading
Mastering charts in SwiftUI. Custom Marks.
The Swift Charts framework is an excellent example of composition. In the previous posts, we saw how we could use different marks on the same chart view to plot different data points. This week we will learn how to use composition to build new custom mark types and reuse them across the app.
30,000 lines of SwiftUI in production later: We love it but you know there was going to be a “but”
It took a few hours to fall in love with SwiftUI. So much so that we instantly decided to abandon a cross-platform codebase and go fully native on iOS. timing.is shipped this month on the App Store. It was built entirely in SwiftUI. It was in development for 12 months.
Variadic Views
To deal with these lists of views (e.g. during layout) we can use the underscored variadic view API. I learned about variadic views through the Moving Parts blog. I don’t know whether this API is going to change in the future, whether it’s App-Store-proof, and so on. It’s probably underscored for a good reason. With that out of the way, let’s get started!
Modern SwiftUI
This week we finished our ambitious, 7-part series exploring modern, best practices for SwiftUI development. In those episodes we rebuilt Apple’s ”Scrumdinger” application, which is a great showcase for many of the problems one encounters in a real life application. Every step of the way we challenged ourselves to write the code in the most scalable and future-proof way possible.
Container Pattern in SwiftUI
Container pattern is a common pattern used in React community. Since React and SwiftUI are quite similar, this pattern can also be used for building SwiftUI applications. In this article, I will focus on the concepts behind the container pattern and how you can use it to build your SwiftUI applications.
The Nested Observables Problem in SwiftUI
The nested ObservableObject problem in SwiftUI refers to a situation where an ObservableObject is used within another ObservableObject. In this case, the inner ObservableObject’s updates will not trigger a re-render of the outer ObservableObject’s views.
Search
Starting with iOS 15, SwiftUI supports search thanks to the new .searchable modifier. It was also extended with the support for tokens in iOS 16 which was exactly what I was waiting for. For me, it was a perfect opportunity to rethink search in Pulse.
Video
Custom Environment Values in SwiftUI
In this video I am going to show you how you can create your own custom Environment Values. We will learn the basics and then create our own environment value that will allow us to apply a different theme to our app based on a particular in app purchase.