How to Navigate to Another View in SwiftUI
October 13, 2025·1 min read·by dockui

Starting from iOS 16, Apple introduced the new NavigationStack API, which replaces NavigationView and makes navigation more powerful and reliable.
NavigationStack and NavigationLink (iOS 16+
In modern SwiftUI, NavigationStack is the container for managing navigation between views. Inside it, you use NavigationLink to move from one view to another.
Here’s the simplest example 👇
Code Snippet
When you tap “Go to Detail View”, SwiftUI smoothly navigates to the next screen.
How NavigationLink Works
A NavigationLink automatically pushes the new view onto the navigation stack.
You don’t need to manage transitions manually — SwiftUI handles back navigation, animations, and state.
Passing Data Between Views
You can easily send data to another view using properties or bindings.
Code Snippet
Navigation in iOS 17 and Later
In iOS 17, Apple further refined NavigationStack and introduced navigation destinations with typed data:
Code Snippet
This lets you build complex navigation flows with type-safe data-driven navigation — perfect for large apps.
Similar Blogs
View All Articles
How to use @AppStorage in SwiftUI
Learn how to use @AppStorage in SwiftUI to save user settings and preferences easily with UserDefaults

How to Make Text Selectable in SwiftUI
Learn how to make text selectable in SwiftUI using the .textSelection(.enabled) modifier. Enable text copying and selection easily in iOS 15 and later with

How to Dismiss a Sheet in SwiftUI
In this guide, you’ll learn the modern way to dismiss a sheet in SwiftUI, how it works, and how to make it fully compatible with your existing code.

How to Add Bar Items to a Navigation View in SwiftUI
Add bar items to your SwiftUI NavigationView using .toolbar() and ToolbarItem. Customize buttons and placement easily.
Code copied to clipboard!