SwiftUI Weekly - Issue #174
The curated collection of links about SwiftUI. Delivered every Monday.
Reading
SwiftUI LazyVGrid & LazyHGrid: Implementing Grid Collection Views
Diving into SwiftUI’s LazyVGrid and LazyHGrid, you can create intricate grid layouts that are both efficient and visually appealing. Unlike a typical grid view, LazyVGrid and LazyHGrid offer more dynamic and flexible ways to display content.
An Approach to Handling App Launch States in SwiftUI
Let's explore how we can show specific View
s for different launch states while your SwiftUI app is opening & loading up. Giving users an awesome experience every time, and making your code super easy to maintain and follow. I have a deep love for enum
s, so we'll base this approach all on an enum
😍. Let's go!
One-way bindings in SwiftUI
Communication between views in SwiftUI can be tricky. As explained in a previous story about SwiftUI State monitoring, SwiftUI PropertyWrappers offer us a lot by hiding some complexity of managing the source of truth for our views. However, they can also bring confusion regarding state management and how to communicate between views.
Unfuddling the SwiftUI Alignment Guide API
In general, I think Apple’s APIs are pretty good. However, there are the occasional exceptions where my brain, for whatever reason, can’t seem to get a hold on the essence of the API design and results in me constantly looking up the docs. In UIKit, the UIAnimatedTransitioning
and UIPresentationController
APIs come to mind.
Migrating to the @Observable macro from ObservableObject
Starting with iOS 17, we were introduced to the @Observable
macro which is meant to replace the ObservableObject
protocol.