Navigation Patterns
Comprehensive guide for SwiftUI navigation architecture on iOS, iPadOS, and macOS. Covers the modern navigation APIs (iOS 16+/macOS 13+) with patterns for common and advanced use cases.
When This Skill Activates
- User is building or reviewing navigation architecture
- User has navigation-related bugs (stack not updating, back button issues, state loss)
- User asks about NavigationStack, NavigationSplitView, TabView, or NavigationPath
- User needs programmatic navigation (push, pop, pop-to-root)
- User is implementing deep linking that connects to navigation
- User asks about navigation transitions or animations
- User is choosing between navigation approaches for their app
Decision Tree
Use this to pick the right navigation container:
What is the app structure?
│
├─ Flat sections (3-5 top-level areas)
│ └─ TabView → see tab-view.md
│
├─ Hierarchical drill-down (list → detail)
│ └─ NavigationStack → see navigation-stack.md
│
├─ Sidebar + content (macOS / iPad)
│ ├─ Two columns → NavigationSplitView → see navigation-split-view.md
│ └─ Three columns → NavigationSplitView → see navigation-split-view.md
│
└─ Combined (tabs with drill-down, sidebar with stacks)
└─ TabView + NavigationStack per tab
OR NavigationSplitView + NavigationStack in detail
Quick Reference
| Pattern |
Container |
Min OS |
Reference |
| Simple drill-down |
NavigationStack |
iOS 16 |
navigation-stack.md |
| Value-based links |
NavigationLink(value:) |
iOS 16 |
navigation-stack.md |
| Programmatic push/pop |
NavigationPath |
iOS 16 |
programmatic-navigation.md |
| Pop to root |
path = NavigationPath() |
iOS 16 |
programmatic-navigation.md |
| State restoration |
NavigationPath.CodableRepresentation |
iOS 16 |
programmatic-navigation.md |
| Two-column layout |
NavigationSplitView |
iOS 16 |
navigation-split-view.md |
| Three-column layout |
NavigationSplitView |
iOS 16 |
navigation-split-view.md |
| Column visibility |
NavigationSplitViewVisibility |
iOS 16 |
navigation-split-view.md |
| Tab bar |
TabView |
iOS 13 |
tab-view.md |
| Customizable tabs |
Tab + TabView |
iOS 18 |
tab-view.md |
| Sidebar tabs (iPad) |
.tabViewStyle(.sidebarAdaptable) |
iOS 18 |
tab-view.md |
| Zoom transition |
.navigationTransition(.zoom) |
iOS 18 |
navigation-transitions.md |
| Custom transitions |
NavigationTransition |
iOS 18 |
navigation-transitions.md |
Navigation Design Rules (WWDC22)
The container APIs above decide how navigation is built; these rules decide whether it's designed right.
Tab bars
- Tabs are top-level content categories, not arbitrary groupings — balance features across tabs so each carries real weight.
- ❌ Never auto-switch tabs in response to an action taken in another tab — confirm in place instead.
Push vs modal
- Push (right-to-left) = traversing the app's hierarchy. Modal (slides up — covering the tab bar is by design) = a self-contained task apart from the hierarchy.
- Modals come in three types: simple task, multi-step task, full-screen content.
- Limit modals presented over modals — each stacked layer buries the user deeper in transient state.
Wayfinding
- Nav bar title = the current location; the back button shows the previous screen's title.
The Three Cookbook Recipes (WWDC22)
Nearly every app is one of these three shapes. Pick one per scene, then lift its navigation state.
- Pushable stack —
NavigationStack(path:) + NavigationLink(value:) + .navigationDestination(for:). Pop-to-root is path.removeAll(); a deep link is just assigning the path.
- Multi-column without stacks —
NavigationSplitView + List(selection:) in each leading column. Value links auto-drive the next column's selection, so programmatic navigation is setting the selection value.
- Split + stack (Photos-style) —
NavigationSplitView with a NavigationStack(path:) inside the detail column: sidebar selection picks the collection, the stack drills into it.
Rules that make the recipes hold up:
- Build with
NavigationSplitView even for iPhone-first apps — it auto-collapses to a single stack in compact width, and iPad/Mac layouts come free.
- Lift navigation state: exactly one bound
path/selection per container. That single source of truth is what makes pop-to-root, deep links, and restoration one-line operations.
State restoration: persist through @SceneStorage("navigation") plus a .task that restores once on appear, then streams subsequent path changes back into storage.
Process
1. Identify Navigation Needs
Read the user's code or requirements to determine:
- App structure (flat, hierarchical, sidebar-based)
- Target platforms (iOS only, iPad adaptive, macOS)
- Whether programmatic navigation is needed
- Deep linking requirements
2. Load Relevant Reference Files
Based on the need, read from this directory:
navigation-stack.md — NavigationStack, NavigationLink, navigationDestination
navigation-split-view.md — Two/three column layouts, column control, adaptive behavior
tab-view.md — TabView, iOS 18 customizable tabs, sidebar mode
programmatic-navigation.md — NavigationPath, state restoration, coordinators, pop-to-root
navigation-transitions.md — Custom push/pop transitions (iOS 18+)
3. Review or Recommend
Apply patterns from the reference files. Check for common mistakes:
4. Cross-Reference
- For deep linking URL handling, see
generators/deep-linking/ skill
- For navigation animations, see
design/animation-patterns/transitions.md
- For macOS sidebar patterns, see
macos/ui-review-tahoe/swiftui-macos.md
References
1---
2name: navigation-patterns
3description: SwiftUI navigation architecture patterns including NavigationStack, NavigationSplitView, TabView, programmatic navigation, and custom transitions. Use when reviewing or building navigation, fixing navigation bugs, or architecting app flow.
4allowed-tools: [Read, Glob, Grep]
5last_verified: 2026-07-16
6review_by: 2027-06-22
7os_version: iOS 27 / macOS 27
8---
9
10# Navigation Patterns
11
12Comprehensive guide for SwiftUI navigation architecture on iOS, iPadOS, and macOS. Covers the modern navigation APIs (iOS 16+/macOS 13+) with patterns for common and advanced use cases.
13
14## When This Skill Activates
15
16- User is building or reviewing navigation architecture
17- User has navigation-related bugs (stack not updating, back button issues, state loss)
18- User asks about NavigationStack, NavigationSplitView, TabView, or NavigationPath
19- User needs programmatic navigation (push, pop, pop-to-root)
20- User is implementing deep linking that connects to navigation
21- User asks about navigation transitions or animations
22- User is choosing between navigation approaches for their app
23
24## Decision Tree
25
26Use this to pick the right navigation container:
27
28```
29What is the app structure?
30│
31├─ Flat sections (3-5 top-level areas)
32│ └─ TabView → see tab-view.md
33│
34├─ Hierarchical drill-down (list → detail)
35│ └─ NavigationStack → see navigation-stack.md
36│
37├─ Sidebar + content (macOS / iPad)
38│ ├─ Two columns → NavigationSplitView → see navigation-split-view.md
39│ └─ Three columns → NavigationSplitView → see navigation-split-view.md
40│
41└─ Combined (tabs with drill-down, sidebar with stacks)
42 └─ TabView + NavigationStack per tab
43 OR NavigationSplitView + NavigationStack in detail
44```
45
46## Quick Reference
47
48| Pattern | Container | Min OS | Reference |
49|---------|-----------|--------|-----------|
50| Simple drill-down | `NavigationStack` | iOS 16 | `navigation-stack.md` |
51| Value-based links | `NavigationLink(value:)` | iOS 16 | `navigation-stack.md` |
52| Programmatic push/pop | `NavigationPath` | iOS 16 | `programmatic-navigation.md` |
53| Pop to root | `path = NavigationPath()` | iOS 16 | `programmatic-navigation.md` |
54| State restoration | `NavigationPath.CodableRepresentation` | iOS 16 | `programmatic-navigation.md` |
55| Two-column layout | `NavigationSplitView` | iOS 16 | `navigation-split-view.md` |
56| Three-column layout | `NavigationSplitView` | iOS 16 | `navigation-split-view.md` |
57| Column visibility | `NavigationSplitViewVisibility` | iOS 16 | `navigation-split-view.md` |
58| Tab bar | `TabView` | iOS 13 | `tab-view.md` |
59| Customizable tabs | `Tab` + `TabView` | iOS 18 | `tab-view.md` |
60| Sidebar tabs (iPad) | `.tabViewStyle(.sidebarAdaptable)` | iOS 18 | `tab-view.md` |
61| Zoom transition | `.navigationTransition(.zoom)` | iOS 18 | `navigation-transitions.md` |
62| Custom transitions | `NavigationTransition` | iOS 18 | `navigation-transitions.md` |
63
64## Navigation Design Rules (WWDC22)
65
66The container APIs above decide *how* navigation is built; these rules decide *whether* it's designed right.
67
68**Tab bars**
69- Tabs are top-level **content categories**, not arbitrary groupings — balance features across tabs so each carries real weight.
70- ❌ Never auto-switch tabs in response to an action taken in another tab — confirm in place instead.
71
72**Push vs modal**
73- Push (right-to-left) = traversing the app's hierarchy. Modal (slides up — covering the tab bar is *by design*) = a self-contained task apart from the hierarchy.
74- Modals come in three types: simple task, multi-step task, full-screen content.
75- Limit modals presented over modals — each stacked layer buries the user deeper in transient state.
76
77**Wayfinding**
78- Nav bar title = the current location; the back button shows the *previous* screen's title.
79
80## The Three Cookbook Recipes (WWDC22)
81
82Nearly every app is one of these three shapes. Pick one per scene, then lift its navigation state.
83
841. **Pushable stack** — `NavigationStack(path:)` + `NavigationLink(value:)` + `.navigationDestination(for:)`. Pop-to-root is `path.removeAll()`; a deep link is just assigning the path.
852. **Multi-column without stacks** — `NavigationSplitView` + `List(selection:)` in each leading column. Value links auto-drive the next column's selection, so programmatic navigation is setting the selection value.
863. **Split + stack (Photos-style)** — `NavigationSplitView` with a `NavigationStack(path:)` *inside the detail column*: sidebar selection picks the collection, the stack drills into it.
87
88**Rules that make the recipes hold up:**
89- Build with `NavigationSplitView` even for iPhone-first apps — it auto-collapses to a single stack in compact width, and iPad/Mac layouts come free.
90- Lift navigation state: exactly one bound `path`/selection per container. That single source of truth is what makes pop-to-root, deep links, and restoration one-line operations.
91
92**State restoration:** persist through `@SceneStorage("navigation")` plus a `.task` that restores once on appear, then streams subsequent path changes back into storage.
93
94## Process
95
96### 1. Identify Navigation Needs
97
98Read the user's code or requirements to determine:
99- App structure (flat, hierarchical, sidebar-based)
100- Target platforms (iOS only, iPad adaptive, macOS)
101- Whether programmatic navigation is needed
102- Deep linking requirements
103
104### 2. Load Relevant Reference Files
105
106Based on the need, read from this directory:
107- `navigation-stack.md` — NavigationStack, NavigationLink, navigationDestination
108- `navigation-split-view.md` — Two/three column layouts, column control, adaptive behavior
109- `tab-view.md` — TabView, iOS 18 customizable tabs, sidebar mode
110- `programmatic-navigation.md` — NavigationPath, state restoration, coordinators, pop-to-root
111- `navigation-transitions.md` — Custom push/pop transitions (iOS 18+)
112
113### 3. Review or Recommend
114
115Apply patterns from the reference files. Check for common mistakes:
116
117- [ ] Using deprecated `NavigationView` instead of `NavigationStack`/`NavigationSplitView`
118- [ ] Using `NavigationLink(destination:)` instead of `NavigationLink(value:)` + `.navigationDestination`
119- [ ] Placing `NavigationStack` in a sidebar/content column of `NavigationSplitView` (a stack belongs only in the detail column — Recipe 3)
120- [ ] `.navigationDestination` attached inside a lazy container (destination may never register)
121- [ ] Missing `.navigationDestination` registration for a value type
122- [ ] NavigationPath not `@State` or not in the right scope
123- [ ] Multiple NavigationStacks competing for the same navigation context
124- [ ] Hard-coding navigation instead of using `NavigationPath` for programmatic control
125- [ ] Not handling deep links through the navigation system
126
127### 4. Cross-Reference
128
129- For **deep linking URL handling**, see `generators/deep-linking/` skill
130- For **navigation animations**, see `design/animation-patterns/transitions.md`
131- For **macOS sidebar patterns**, see `macos/ui-review-tahoe/swiftui-macos.md`
132
133## References
134
135- [NavigationStack](https://developer.apple.com/documentation/swiftui/navigationstack)
136- [NavigationSplitView](https://developer.apple.com/documentation/swiftui/navigationsplitview)
137- [NavigationPath](https://developer.apple.com/documentation/swiftui/navigationpath)
138- [TabView](https://developer.apple.com/documentation/swiftui/tabview)
139- [Migrating to new navigation types](https://developer.apple.com/documentation/swiftui/migrating-to-new-navigation-types)