GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

Navigation: Introduction

Paul Hudson    @twostraws   

In this technique project we’re going to take a close look at navigation in SwiftUI – how we move from one screen to another using NavigationStack, both because the user asked for it and also because we want to do it automatically at a specific time.

Once we've covered those basics, we're going to look at more advanced navigation, including handling state restoration – remembering exactly where the user had navigated to, so when your app launches in the future they can pick up where they left off.

And when we're done with that we'll look at some customization options: changing the way the navigation bar looks, positioning your buttons just right, and even how to let your user change the navigation title on demand.

That's a lot to cram in, but by the end of it all you'll have a much stronger understanding of how navigation works in SwiftUI, so you can really make the most of it in all your apps.

Please create a new App project called Navigation and let’s get started…

Hacking with Swift is sponsored by Alex.

SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today!

Try for free!

Sponsor Hacking with Swift and reach the world's largest Swift community!

BUY OUR BOOKS
Buy Pro Swift Buy Pro SwiftUI Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Interview Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let us know!

Average rating: 4.9/5

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.