Communitygithub.com

ComeOnOliver/skillshub

Referenz – Umfassender SwiftUI-Navigationsleitfaden mit Abdeckung von NavigationStack (iOS 16+), NavigationSplitView (iOS 16+), NavigationPath, Deep Linking, Zustandswiederherstellung, Tab+Navigationsintegration (iOS 18+), Liquid Glass Navigation (iOS 26+) und Koordinatormustern.

Was ist skillshub?

Dieses Skill bietet eine vollständige Referenz zur SwiftUI-Navigation, die von einfachen Stacks bis zu komplexen Multi-Column-Layouts reicht. Es behandelt die Entwicklung von NavigationStack und NavigationSplitView (eingeführt in iOS 16), die Tab-/Sidebar-Vereinheitlichung in iOS 18 und das Liquid Glass Design aus iOS 26. Der Skill erklärt datengesteuerte Navigation mit NavigationPath, Deep Linking, Zustandswiederherstellung mit Codable und SceneStorage sowie die Integration von Tabs mit NavigationStacks. Entwickler lernen, wann sie SwiftUI-Navigation anstelle von UIKit (UINavigationController) verwenden sollten, und erhalten praktische Codebeispiele, Timing-Diagramme und Best Practices für die Vermeidung von Anti-Patterns. Der Skill ist ideal für alle, die moderne, plattformübergreifende SwiftUI-Apps mit robusten Navigationsflüssen erstellen.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/CharlesWiltgen/Axiom/axiom-swiftui-nav-ref

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

SwiftUI Navigations-API-Referenz

Überblick

Die Navigations-APIs von SwiftUI bieten datengesteuerte, programmatische Navigation, die von einfachen Stacks bis zu komplexen Multi-Column-Layouts skaliert. Eingeführt in iOS 16 (2022) mit NavigationStack und NavigationSplitView, weiterentwickelt in iOS 18 (2024) mit Tab-/Sidebar-Vereinheitlichung und verfeinert in iOS 26 (2025) mit Liquid Glass Design.

Entwicklungs-Zeitleiste

  • 2022 (iOS 16) NavigationStack, NavigationSplitView, NavigationPath, wertbasierter NavigationLink
  • 2024 (iOS 18) Tab-/Sidebar-Vereinheitlichung, sidebarAdaptable-Stil, Zoom-Navigationsübergang
  • 2025 (iOS 26) Liquid Glass Navigations-Chrome, unten ausgerichtete Suche, schwebende Tab-Leisten, backgroundExtensionEffect

Hauptfunktionen

  • Datengesteuerte Navigation NavigationPath repräsentiert den Stack-Status und ermöglicht programmatisches Push/Pop und Deep Linking
  • Multi-Column-Layouts NavigationSplitView passt sich automatisch an (3-Spalten auf iPad → einzelner Stack auf iPhone)
  • Zustandswiederherstellung Codable NavigationPath + SceneStorage für Persistenz über App-Starts hinweg
  • Tab-Integration Pro-Tab NavigationStack mit Zustandserhaltung beim Tab-Wechsel (iOS 18+)
  • Liquid Glass Automatische Glas-Navigationsleisten, Sidebars und Toolbars (iOS 26+)

Wann verwenden vs. UIKit

  • SwiftUI-Navigation Neue Apps, plattformübergreifend, einfachere Navigationsflüsse → NavigationStack/SplitView verwenden
  • UINavigationController Komplexe Koordinatormuster, Legacy-Code, spezifische UIKit-Funktionen → UIKit in Betracht ziehen

Verwandte Skills

  • Verwenden Sie axiom-swiftui-nav für Anti-Patterns, Entscheidungsbäume, Druckszenarien
  • Verwenden Sie axiom-swiftui-nav-diag für systematische Fehlerbehebung von Navigationsproblemen

Wann dieses Skill verwenden

Verwenden Sie dieses Skill, wenn:

  • Implementierung von Navigations-APIs NavigationStack, NavigationSplitView, NavigationPath, Tab+Navigation
  • Deep Linking oder Zustandswiederherstellung URL-Routing, Codable NavigationPath, SceneStorage
  • Übernahme von iOS 26+-Funktionen Liquid Glass Navigation, unten ausgerichtete Suche, Minimierung der Tab-Leiste
  • Wahl der Navigationsarchitektur Stack vs. SplitView vs. Koordinatormuster

API-Entwicklung

Zeitleiste

JahriOS-VersionHauptfunktionen
2020iOS 14NavigationView (veraltet ab iOS 16)
2022iOS 16NavigationStack, NavigationSplitView, NavigationPath, wertbasierter NavigationLink
2024iOS 18Tab-/Sidebar-Vereinheitlichung, sidebarAdaptable, TabSection, Zoom-Übergänge
2025iOS 26Liquid Glass Navigation, backgroundExtensionEffect, tabBarMinimizeBehavior

NavigationView (Veraltet)

NavigationView ist ab iOS 16 veraltet. Verwenden Sie ausschließlich NavigationStack (Einzelspalten Push/Pop) oder NavigationSplitView (Mehrspalten) in neuem Code. Wichtige Verbesserungen: Ein einzelner NavigationPath ersetzt die per-Link isActive-Bindungen, wertbasierte Typsicherheit, integrierte Codable-Zustandswiederherstellung. Siehe Dokumentation „Migration zu neuen Navigationstypen“.


NavigationStack vollständige Referenz

NavigationStack repräsentiert eine Push-Pop-Oberfläche wie Einstellungen auf dem iPhone oder Systemeinstellungen auf dem Mac.

1.1 NavigationStack erstellen

Basis NavigationStack

NavigationStack {
    List(Category.allCases) { category in
        NavigationLink(category.name, value: category)
    }
    .navigationTitle("Categories")
    .navigationDestination(for: Category.self) { category in
        CategoryDetail(category: category)
    }
}

Mit Pfadbindung (WWDC 2022, 6:05)

struct PushableStack: View {
    @State private var path: [Recipe] = []
    @StateObject private var dataModel = DataModel()

    var body: some View {
        NavigationStack(path: $path) {
            List(Category.allCases) { category in
                Section(category.localizedName) {
                    ForEach(dataModel.recipes(in: category)) { recipe in
                        NavigationLink(recipe.name, value: recipe)
                    }
                }
            }
            .navigationTitle("Categories")
            .navigationDestination(for: Recipe.self) { recipe in
                RecipeDetail(recipe: recipe)
            }
        }
        .environmentObject(dataModel)
    }
}

Pfadbindung + wertpräsentierender NavigationLink + navigationDestination(for:) bilden das zentrale datengesteuerte Navigationsmuster.

1.2 NavigationLink (Wertbasiert)

Wertpräsentierender NavigationLink

// Richtig: Wertbasiert (iOS 16+)
NavigationLink(recipe.name, value: recipe)

// Richtig: Mit benutzerdefiniertem Label
NavigationLink(value: recipe) {
    RecipeTile(recipe: recipe)
}

// Veraltet: Ansichtsbasiert (iOS 13-15)
NavigationLink(recipe.name) {
    RecipeDetail(recipe: recipe)  // Nicht in neuem Code verwenden
}

Wie NavigationLink mit NavigationStack funktioniert

  1. NavigationStack verwaltet eine path-Sammlung
  2. Tippen auf einen wertpräsentierenden Link fügt den Wert an die Sammlung an
  3. NavigationStack wendet navigationDestination-Modifikatoren auf die Pfadwerte an
  4. Ansichten werden basierend auf den Zielzuordnungen auf den Stack geschoben

1.3 navigationDestination-Modifikator

Einzelner Typ

.navigationDestination(for: Recipe.self) { recipe in
    RecipeDetail(recipe: recipe)
}

Mehrere Typen

NavigationStack(path: $path) {
    RootView()
        .navigationDestination(for: Recipe.self) { recipe in
            RecipeDetail(recipe: recipe)
        }
        .navigationDestination(for: Category.self) { category in
            CategoryList(category: category)
        }
        .navigationDestination(for: Chef.self) { chef in
            ChefProfile(chef: chef)
        }
}

Navigations-Anti-Patterns

  • Mischen Sie niemals navigationDestination(for:) und NavigationLink(destination:) in derselben NavigationStack-Hierarchie – verursacht undefiniertes Verhalten
  • Registrieren Sie navigationDestination(for:) einmal pro Datentyp – Duplikate führen dazu, dass die falsche Ansicht erscheint

Platzierungsregeln

  • Platzieren Sie navigationDestination außerhalb von Lazy-Containern (nicht innerhalb von ForEach)
  • Platzieren Sie es in der Nähe verwandter NavigationLinks zur Code-Organisation
  • Muss innerhalb der NavigationStack-Hierarchie sein
// Richtig: Außerhalb des Lazy-Containers
ScrollView {
    LazyVGrid(columns: columns) {
        ForEach(recipes) { recipe in
            NavigationLink(value: recipe) {
                RecipeTile(recipe: recipe)
            }
        }
    }
}
.navigationDestination(for: Recipe.self) { recipe in
    RecipeDetail(recipe: recipe)
}

// Falsch: Innerhalb von ForEach (wird möglicherweise nicht geladen)
ForEach(recipes) { recipe in
    NavigationLink(value: recipe) { RecipeTile(recipe: recipe) }
        .navigationDestination(for: Recipe.self) { r in  // Nicht so machen
            RecipeDetail(recipe: r)
        }
}

1.4 NavigationPath

NavigationPath ist eine typgelöschte Sammlung für heterogene Navigationsstapel.

Typisiertes Array vs. NavigationPath

// Typisiertes Array: Alle Werte gleicher Typ
@State private var path: [Recipe] = []

// NavigationPath: Gemischte Typen
@State private var path = NavigationPath()

NavigationPath-Operationen

// Wert anhängen
path.append(recipe)

// Zum vorherigen zurück
path.removeLast()

// Zur Wurzel zurück
path.removeLast(path.count)
// oder
path = NavigationPath()

// Anzahl prüfen
if path.count > 0 { ... }

// Deep Link: Mehrere Werte setzen
path.append(category)
path.append(recipe)

Codable-Unterstützung

// NavigationPath ist Codable, wenn alle Werte Codable sind
@State private var path = NavigationPath()

// Codieren
let data = try JSONEncoder().encode(path.codable)

// Decodieren
let codableRep = try JSONDecoder().decode(NavigationPath.CodableRepresentation.self, from: data)
path = NavigationPath(codableRep)

NavigationSplitView vollständige Referenz

NavigationSplitView erstellt Multi-Column-Layouts, die sich an die Gerätegröße anpassen.

2.1 Zwei-Spalten-Layout

Basis Zwei-Spalten (WWDC 2022, 10:40)

struct MultipleColumns: View {
    @State private var selectedCategory: Category?
    @State private var selectedRecipe: Recipe?
    @StateObject private var dataModel = DataModel()

    var body: some View {
        NavigationSplitView {
            List(Category.allCases, selection: $selectedCategory) { category in
                NavigationLink(category.localizedName, value: category)
            }
            .navigationTitle("Categories")
        } detail: {
            if let recipe = selectedRecipe {
                RecipeDetail(recipe: recipe)
            } else {
                Text("Select a recipe")
            }
        }
    }
}

2.2 Drei-Spalten-Layout

Fügen Sie einen content:-Closure zwischen Sidebar und Detail für eine mittlere Spalte hinzu:

NavigationSplitView {
    List(Category.allCases, selection: $selectedCategory) { category in
        NavigationLink(category.localizedName, value: category)
    }
} content: {
    List(dataModel.recipes(in: selectedCategory), selection: $selectedRecipe) { recipe in
        NavigationLink(recipe.name, value: recipe)
    }
} detail: {
    RecipeDetail(recipe: selectedRecipe)
}

2.3 NavigationSplitView mit NavigationStack

Platzieren Sie einen NavigationStack(path:) innerhalb der Detailspalte für Grid-zu-Detail-Drill-Down, während die Sidebar-Auswahl erhalten bleibt:

NavigationSplitView {
    List(Category.allCases, selection: $selectedCategory) { ... }
} detail: {
    NavigationStack(path: $path) {
        RecipeGrid(category: selectedCategory)
            .navigationDestination(for: Recipe.self) { recipe in
                RecipeDetail(recipe: recipe)
            }
    }
}

2.4 Spaltensichtbarkeit

@State private var columnVisibility: NavigationSplitViewVisibility = .all

NavigationSplitView(columnVisibility: $columnVisibility) {
    Sidebar()
} content: {
    Content()
} detail: {
    Detail()
}

// Programmatisch Sichtbarkeit steuern
columnVisibility = .detailOnly  // Sidebar und Inhalt ausblenden
columnVisibility = .all          // Alle Spalten anzeigen
columnVisibility = .automatic    // System entscheidet

2.5 Automatische Anpassung

NavigationSplitView passt sich automatisch an:

  • iPad Landscape Alle Spalten sichtbar (je nach Konfiguration)
  • iPad Portrait/Slide Over Kollabiert zu Overlay oder einzelner Spalte
  • iPhone Einzelner Navigationsstapel
  • Apple Watch/TV Einzelner Navigationsstapel

Auswahländerungen werden automatisch in Push/Pop auf dem iPhone übersetzt.

2.6 iOS 26+ Liquid Glass Sidebar (WWDC 2025, 323)

NavigationSplitView {
    List { ... }
} detail: {
    DetailView()
}
// Sidebar erhält automatisch Liquid Glass-Erscheinungsbild auf iPad/macOS

// Inhalt hinter Glas-Sidebar erweitern
.backgroundExtensionEffect()  // Spiegelt und weicht Inhalt außerhalb des Safe Area

Deep Linking und URL-Routing

3.1 Deep Link-Muster

Verwenden Sie .onOpenURL, um URLs zu empfangen, parsen Sie sie mit URLComponents und manipulieren Sie dann den NavigationPath:

.onOpenURL { url in
    guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false),
          let host = components.host else { return }
    path.removeLast(path.count)  // Zuerst zur Wurzel zurück
    // Host/Pfad parsen, um Ziel zu bestimmen, dann path.append(value)
}

Für mehrstufige Deep Links (myapp://category/desserts/recipe/apple-pie) iterieren Sie über die URL-Pfadkomponenten und hängen jeden aufgelösten Wert an, um den vollständigen Navigationsstapel aufzubauen.

Für umfassende Deep-Linking-Beispiele, Fehlerdiagnose und Test-Workflows siehe axiom-swiftui-nav-diag (Muster 3).


Zustandswiederherstellung

4.1 Vollständige Zustandswiederherstellung (WWDC 2022, 18:12)

struct UseSceneStorage: View {
    @StateObject private var navModel = NavigationModel()
    @SceneStorage("navigation") private var data: Data?
    @StateObject private var dataModel = DataModel()

    var body: some View {
        NavigationSplitView {
            List(Category.allCases, selection: $navModel.selectedCategory) { category in
                NavigationLink(category.localizedName, value: category)
            }
            .navigationTitle("Categories")
        } detail: {
            NavigationStack(path: $navModel.recipePath) {
                RecipeGrid(category: navModel.selectedCategory)
            }
        }
        .task {
            // Beim Erscheinen wiederherstellen
            if let data = data {
                navModel.jsonData = data
            }
            // Bei Änderungen speichern
            for await _ in navModel.objectWillChangeSequence {
                data = navModel.jsonData
            }
        }
        .environmentObject(dataModel)
    }
}

4.2 Codable NavigationModel

class NavigationModel: ObservableObject, Codable {
    @Published var selectedCategory: Category?
    @Published var recipePath: [Recipe] = []

    enum CodingKeys: String, CodingKey {
        case selectedCategory
        case recipePathIds  // Speichere IDs, nicht vollständige Objekte
    }

    func encode(to encoder: Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encodeIfPresent(selectedCategory, forKey: .selectedCategory)
        try container.encode(recipePath.map(\.id), forKey: .recipePathIds)
    }

    init() {}

    required init(from decoder: Decoder) throws {
        let container = try decoder.container(keyedBy: CodingKeys.self)
        self.selectedCategory = try container.decodeIfPresent(Category.self, forKey: .selectedCategory)
        let recipePathIds = try container.decode([Recipe.ID].self, forKey: .recipePathIds)
        self.recipePath = recipePathIds.compactMap { DataModel.shared[$0] } // Gelöschte Elemente verwerfen
    }
}

Speichern Sie IDs (nicht vollständige Modellobjekte) und verwenden Sie compactMap, um gelöschte Elemente elegant zu behandeln. Fügen Sie die jsonData-berechnete Eigenschaft und objectWillChangeSequence für die SceneStorage-Integration hinzu, wie in 4.1 gezeigt.


Tab + Navigationsintegration

5.1 Tab-Syntax (iOS 18+) (WWDC 2024, 4:27)

TabView {
    Tab("Watch Now", systemImage: "play") {
        WatchNowView()
    }
    Tab("Library", systemImage: "books.vertical") {
        LibraryView()
    }
    ...
}

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

Verwandte Skills