SwiftUI Weekly - Issue #232
The curated collection of links about SwiftUI. Delivered every Monday.
Emphasized variants of system text
You can display emphasized variants of system text styles using symbolic traits. In SwiftUI, use the bold() modifier; in UIKit, use traitBold in the UIFontDescriptor API. The emphasized weights can be medium, semibold, bold, or heavy. It is not always bold.
SwiftUI: Refreshable Task Cancellation
Pull-to-refresh became a standard interaction in iOS apps long ago, so .refreshable feels like one of the most natural SwiftUI APIs. You attach the modifier, await some async work, and SwiftUI handles the native refresh behavior for you.
Previewing SwiftUI views in both dark and light mode
The light and dark mode feature in iOS was a very welcome addition when it was first introduced. These days it's more or less expected that a high-quality app has a good implementation of both light and dark color schemes. The iOS frameworks have very good support for implementing this, so this post won't go into any details there. Instead, we'll take a look at how you can easily preview both cases (and any potential future cases) using a very simple view struct in SwiftUI.
Building a draggable bottom sheet in SwiftUI
Some apps, such as Apple Maps or Google Maps, use a draggable bottom sheet to let users switch between the main content, for example a map, and additional information presented in a sheet. In this article, we’ll look at how to build a draggable bottom sheet that works together with a scroll view and still allows interaction with the underlying content.
Checking accessibility with SwiftUI Previews
SwiftUI previews are a great way to check your design looks as expected while you’re writing code, without having to wait for a full project to build. But did you know you can also use them to check that your accessibility experience looks as it should? While assistive technologies like VoiceOver or Voice Control require require interaction on a real device, previews can still help verify anything that has a visible impact on our UI.
