SwiftUI Weekly - Issue #239
Building adaptive non-modal panels in SwiftUIIn our walking app Strolly, we make heavy use of non-modal sheets with small and medium detents so users can interact with the map and its controls at the same time. Until recently, the app only supported portrait orientation on iPhone. As part of our latest update, we wanted to support landscape layouts in preparation for the app resizability requirements coming with iOS 27. The system sheet API does not preserve its non-modal presentation when an iPhone rotates to landscape, so we had to find another solution. Scalable Custom Fonts in SwiftUICustom fonts were one of those taboo topics for me. I didn't know how to utilize them properly. I would add custom fonts to a project, and set very specific font sizes and weights to make the view pixel perfect... on one device. Later I learned about preferred font sizes and how they worked. It kinda rocked my world. Afterwards, I was able to please both our users and creatives with UIFont extensions in UIKit. Concentric Buttons with OS 27's SwiftUI APIsSwiftUI for iOS, iPadOS, and macOS 27 (I'll shorten this to *OS 27 from here on) is bringing a lot of new additions. One particular addition that is very interesting to me is the ability to read out Managing focus in SwiftUI with FocusStateSwiftUI provides the @FocusState property wrapper to observe and control focus in a view hierarchy. We can use it to focus a text field programmatically, move focus between fields, or remove focus to dismiss the keyboard. Geometry, compositing and drawing groups in SwiftUISwiftUI provides three modifiers with very similar names that group views for different purposes. The geometryGroup() modifier isolates a view's geometry from its parent. The compositingGroup() modifier wraps a view in a compositing group, so compositing effects from outside the group, such as opacity and blend modes, operate at that boundary. The drawingGroup(opaque:colorMode:) modifier flattens supported content into an offscreen image before display. Understanding which part of the rendering process is being grouped helps us choose the right modifier for each situation.
|