← ClaudeAtlas

swiftui-navigation-architecturelisted

Default navigation shape for SwiftUI Apps (iOS 18 / macOS 15, Swift 6) — value-based `NavigationStack(path:)` over a typed `Route` enum, one `@Observable @MainActor` Router in `.environment`, `navigationDestination(for:)` at the stack root (never in a lazy container), per-transition presentation semantics (push / sheet / `fullScreenCover` / popover / alert / root-swap) incl. macOS behavior (no native `fullScreenCover` → push fallback, pop-to-landing), `item:`-driven modal optionals, `.onOpenURL` deep-link funnel, `NavigationSplitView`, per-tab paths, `Codable` restoration. Invoke when wiring an App's navigation, choosing sheet vs cover vs push, adding deep links / restoration, migrating off `NavigationView`, or asked "router / coordinator in SwiftUI". Bugs → swiftui-interaction-footguns.
wei18/apple-dev-skills · ★ 0 · Web & Frontend · score 70
Install: claude install-skill wei18/apple-dev-skills
# SwiftUI Navigation Architecture The default navigation shape for Apps on this catalog's baseline ([[apple-platform-targets]]: iOS 18 / macOS 15, Swift 6 language mode): navigation state is **data** — a typed route enum in one observable router — so flows are unit-testable (assert on `[Route]`), deep-linkable (URL → routes is a pure function), and restorable (routes are `Codable`). ## When to invoke - Wiring navigation in a new App target, or adding a second entry point (deep link, widget tap, notification, tab) - Adding deep links / universal links or state restoration to an existing App - Migrating off `NavigationView` or view-payload `NavigationLink(destination:)` - Asked "how do I do a router / coordinator in SwiftUI?" ## Scope Owns container choice (Stack / SplitView / Tab), route modeling, the router object, deep-link funneling, and restoration. Does NOT own: known interaction bugs in nav components → [[swiftui-interaction-footguns]]; injecting the services destination views need → [[swift-dependency-injection]]; nav-chrome accessibility → [[ios-accessibility-engineering]]. ## Pick the container | App shape | Container | |---|---| | Single drill-down flow (iPhone-first) | `NavigationStack(path:)` | | 2–5 top-level peer sections | `TabView` + one `NavigationStack` per tab, each with its own path | | Source list → detail (iPad / Mac) | `NavigationSplitView`; sidebar selection is router state, the detail column hosts its own `NavigationStack` | Never `NavigationVi