Navigation patterns

From gustavscirulis/snapgrid · View interactive version

Navigation patterns is an AI agent skill from the GitHub repository gustavscirulis/snapgrid. 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.

How to use this skill

Skill file

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

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 |

Process

1. Identify Navigation Needs

Read the user's code or requirements to determine:

2. Load Relevant Reference Files

Based on the need, read from this directory:

3. Review or Recommend

Apply patterns from the reference files. Check for common mistakes:

4. Cross-Reference

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.