When you create a new Widget you may have noticed that it gets its own asset catalog. As well as the usual
AccentColorthis also contains a
WidgetBackgroundcolor. What are these for and how are you supposed to use them?
Create your own custom SwiftUI view modifier when you want to reuse a set of modifiers on multiple views. Removing duplication also cleans up and improves the readability of your SwiftUI views.
Resulttype is handy way to capture the results of a throwing expression that you need to execute on a background thread. Use
flatMapto chain several results together.
The Swift If-Case-Let syntax is a convenient shortcut to avoid a full switch statement when you only want to match a single case. The syntax always seems backwards to me so here’s a reminder of how to use it.
If you’re creating your images from the asset catalog you support dark mode by adding light and dark variations of the image. How about when you’re creating the images at runtime? How about when you’re using SwiftUI?