SwiftUI Weekly - Issue #122
The curated collection of links about SwiftUI. Delivered every Monday.
Sponsor
Ship your iOS apps faster! — codemagic.io
CI/CD for iOS and macOS developers. Fast builds on M1 machines and predictable pricing. Automatic code signing and publishing with really good documentation.
Reading
Swift Charts Tutorial: Getting Started
Learn how to use Swift Charts to transform data into elegant and accessible graphs.
Sized-to-fit SwiftUI bottom sheet
With Xcode 14, Apple introduced a PresentationDetent struct into SwiftUI, to control the height of a bottom sheet.
Applying complex gestures to a SwiftUI view
As we saw in last week’s post, complex gestures in a SwiftUI ScrollView is complicated, since they can block the scrolling. However, if we don’t have a scroll view, things become a lot easier. Let’s take a look at a version of the button that we created last week, that uses a single gesture.
SwiftUI custom layout with Simple Layout Engine
The maths required for SwiftUI custom layout reminds me of the days before AutoLayout and the constraints based system. The good thing is that Simple Layout Engine already provides a nice system to handle all the maths involved. To demonstrate I would use build the subset of the demo app from the WWDC session on this topic: Compose custom layouts with SwiftUI.
clipped() doesn’t affect hit testing
The
modifier in SwiftUI doesn’t limit hit testing to the clipping region. The clipped view can still receive taps/clicks outside the visible area. Add
to change this behavior.
Code
Better SwiftUI navigation APIs
Navigation in SwiftUI can be complex, but it doesn't have to be that way. We are releasing a
new version of our SwiftUI Navigation library that makes it easier to use NavigationStack,
alerts, confirmation dialogs, and even fixes a few bugs in SwiftUI.
Video
AnyLayout and Custom Layouts in iOS 16
In this video, I will show you the new AnyLayout, the type-erased instance of the layout protocol that allows you to dynamically change the type of layout container without destroying the stat of the subviews.