SwiftUI Weekly - Issue #173
The curated collection of links about SwiftUI. Delivered every Monday.
Reading
StoreKit testing in Swift
The second iteration of the StoreKit framework was the most significant change in my apps during the last few years. The recent version of the StoreKit framework has fully adopted Swift language features like async and await. This week, we will talk about the StoreKitTest framework, which is not a part of StoreKit 2 but is tightly coupled with it.
@Observable Macro performance increase over ObservableObject
The @Observable Macro was first introduced during WWDC 2023 to replace ObservableObject and its @Published parameters. The macro allows you to remove all published properties while still being able to redraw SwiftUI views when a change occurs automatically.
Perception: A back-port of @Observable
Swift 5.9 brought powerful observation tools to the language, but unfortunately, they only work in iOS 17, macOS 14, tvOS 17, watchOS 10, and newer. But by some accounts, less than 50% of devices are on iOS 17, and so most developers will not be able to make use of these tools for a few more years.
A Girl and her @ViewBuilder
note: the story here is fictional, but it’s an approach I love to take when solving similar problems. I hope you enjoy it and get a good understanding of how to make use of @ViewBuilder
in SwiftUI apps.
Asynchronous SwiftUI buttons
SwiftUI buttons are an example of what I would call an awesome and straight-to-the-point API: you describe a button and have a closure when it’s pressed!
Is MVVM Dead in SwiftUI?
In summary, exemplified by leaders, the shift away from traditional MVVM in SwiftUI highlights a trend towards simpler patterns, advocating for logic embedded within views. This trend prompts reflection on whether these alternative approaches better suit individual development needs. Adapting to these changing paradigms is crucial in navigating the evolving landscape of app development.