Reading time: 1 min
This quick recipe shows how to support nested NavigationLinks and allow the user to move back programatically. As always, SwiftUI throws a curveball even on trivial tasks such as this. Here's what the end result looks like:
OK, so the situation you have is as following:
- You have a multi-le...
SwiftUI Segues
Reading time: 6 min
This recipe shows how to add easy-to-use segues to your SwiftUI navigation. They allow for presenting views using common UIKIt Segue types - push, modal and popover. The end result looks like this:
Navigating between views/screens in SwiftUI is more difficult and convoluted than it is in UIK...
Navigation bar styling in SwiftUI
Reading time: 2 min
This tutorial shows how to style a navigation bar in SwiftUI - changing its background color, text color, as well as styling the status bar. The end result looks like this:
This component is available as a Swift Package in this repo.
The gist of the work is in using a ViewModifier...
Side menu in SwiftUI (updated 05/21)
Reading time: 4 min
This tutorial shows how to create a side menu (or navigation drawer, as it's known on Android), in SwiftUI. It's also a good showcase of using GeometryReader
to offset views and DragGesture
to detect user gestures. The end result will look like this:
This component is available as a S...
Customize navigation bar button image
Reading time: 1 min
This tutorial shows how to customize the navigation bar buttons as images. It applies to both the back button, as well as the button on the right-hand side. The end result will look something like this:
To do so, use the navigationBarItems(leading:trailing)
method. As always, the navigation...