SwiftUI Weekly - Issue #234
Deprecating your own convenience APIAlmost after every major update of iOS, we got new APIs that we use on the most recent platform but can’t use on the previous one. Usually, I solve this kind of thing by introducing my own convenience code that runs new APIs on the available versions and my custom implementation or stubs on old platform versions. Making a SwiftUI sheet automatically size to fit its contentAn iOS sheet defaults to covering around half the screen, and while you can specify custom detents, it’s not enough. This article shows you how to easily make a sheet size to fit its content. A floating card using safeAreaBarThe safeAreaBar view modifier is another way to manage the safe area of the view. The safeAreaBar view modifier allows you to shift the safe area of the view by placing another view inside the original safe area of the view. ContentUnavailableView in SwiftUISwiftUI has steadily evolved from a declarative UI framework into a platform with thoughtful, production ready UI components. One of the most underrated additions is Modern SwiftUI APIs for programmatic scrollingiOS 17 introduced scrollPosition(id:anchor:), replacing the proxy approach with a state binding. iOS 18 went further, introducing a more capable scrollPosition(_:anchor:) modifier and the ScrollPosition struct that expresses position as an identifier, an edge, or a raw offset. iOS 18 also added onScrollGeometryChange(for:of:action:), which provides continuous access to the scroll view's geometry as the user scrolls.
|