OK, things are starting to look really amazing. We now have the tools to model 5 different types of navigation in our domains, alerts, dialogs, sheets, popovers, and covers, and the tools to hook up those domains to SwiftUI. And these tools help us out with lots of sharp edges and subtleties, such as cancelling inflight effects when a feature is dismissed.
But there is a huge, gaping hole in our tools for navigation, and it has to do with the kind of navigation that probably all of our viewers think of when we say the word “navigation.” And that’s “drill-down” navigation.
This is the style of navigation that occurs when you tap a button in the UI, and the screen transitions to the next screen. And you get some niceties built into iOS, such as a back button in the top-left, or even the ability to perform a swipe gesture to go back.
The APIs to accomplish this style of navigation have recently gone through some big changes in iOS 16. In particular, many of the navigation APIs that were available in SwiftUI on day 1 were deprecated, and all new tools were added in iOS 16.
We are going to first get our feet wet with drill-down navigation by building the tools on top of the older, deprecated APIs. That may seem weird, but also the vast majority of people right now are still targeting versions of iOS less than 16, and so these tools are still very much necessary. And luckily understanding the older APIs will help us with the new ones too, so it’s a win-win.
So, let’s see what it takes to add a drill-down navigation to our application.