SwiftUI Toolbar Placement Cheatsheet
Reading time: 5 min
This recipe is a cheatsheet for various ToolbarItemPlacement
values and combinations on iOS. This is useful because:
- The namings of the placement values don't necessarily clearly depict where will a
ToolbarItem
end up. - Some values don't play well with each other. E.g,
.primaryAction
will hide.confirmationAction
if it's placed above it, but not if placed below. - Some positions change if
TitleDisplayMode
is.inline
.
Map with Annotations in SwiftUI
Reading time: 6 min
This recipe shows how to add a Map View using SwiftUI. It also shows how to add pins/markers/annotations to the map, allowing for mixing of different map annotation types.
ScrollViewReader + onChange = Responsive Tabs
Reading time: 2 min
This recipe shows how to combine ScrollViewReader
and onChange(of:perform:)
to jump to the selected item in a scrollable view. We'll use this method to update our top tabs and make them fully visible when selected.
Material Indefinite Loading Bar in SwiftUI
Reading time: 1 min
This recipe shows how to implement an indefinite loading bar in SwiftUI. This kind of view is common in Android Material Design as it's sleek and takes up less space than a conventional, circular LoadingView
.
Custom View Dialog in SwiftUI
Reading time: 1 min
This recipe show how to display a custom dialog in SwiftUI. You can customize the dialog content in any way you want.