From the course: Complete Guide to SwiftUI

Unlock this course with a free trial

Join today to access over 24,600 courses taught by industry experts.

Create navigation paths

Create navigation paths

- [Instructor] While our navigation works, we'd like more polishing and customization, including a more visible back button. To make back buttons, we use a navigation path. Navigation paths keep a sequential collection of our current location in the stack view and all views to get there. So we're going to start here in content view and we're going to declare a navigation path as a state variable. And again, it's going to be a private one, so I can put it under all these rest of these private ones here. We'll call it Path. And it's a navigation path type. And we will set it to an empty path, which is just the initialization navigation path like that. So we've got our path set up now, and then we're going to add the path variable to a whole bunch of places. The first one we're going to do is right here in the navigation stack itself. So we'll say the navigation stack is going to use a path. And from here on in we're going to be doing lots of binding variables. And then where we're…

Contents