SwiftUI Weekly - Issue #148
The curated collection of links about SwiftUI. Delivered every Monday.
This year we have massive additions to the ScrollView functionality in SwiftUI. Apple has added a bunch of new APIs to work with the ScrollView. This week we will talk about snapping behavior in ScrollView and how we can customize the scroll target.
Starting with Xcode 15 and Swift 5.9, you can create previews for your SwiftUI view using the new #preview Macro. The macro replaces the
PreviewProviderprotocol that required us to define previews within a static computed property.
Sizing something relative to another thing’s size wasn’t always ideal from an API perspective. For example, you might’ve reached for
GeometryReader to drive relative sizing. However, it was always a somewhat “sweet solution”, as the reader itself was a container view which may or may not produce the results you’re actually after depending on the view hierarchy.
Relationships In SwiftData 🚀 | Adding Categories To A To-Do App, SwiftData Tutorial.
iOS 17 introduces the new Observation Framework as well as the @Observable macro. This is a new an improved way to update your UI when underlying data of a model object changes and the concept of @StateObject and @ObservedObject no longer apply. This has cleaner syntax and better performance so it is a welcomed update.