{"id":15055334,"url":"https://github.com/o-nnerb/navigation-kit","last_synced_at":"2026-02-21T17:03:52.543Z","repository":{"id":112551483,"uuid":"605325147","full_name":"o-nnerb/navigation-kit","owner":"o-nnerb","description":"Navigation library for SwiftUI apps","archived":false,"fork":false,"pushed_at":"2025-12-08T16:04:49.000Z","size":115,"stargazers_count":8,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-20T10:08:01.377Z","etag":null,"topics":["declarative","ios","navigation","swift","swift-package-manager","swiftui","tca"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/o-nnerb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-02-22T23:19:39.000Z","updated_at":"2025-11-22T18:50:19.000Z","dependencies_parsed_at":"2024-10-29T20:32:03.947Z","dependency_job_id":"f2a6370d-2a9d-4605-9220-a297f7abc5dd","html_url":"https://github.com/o-nnerb/navigation-kit","commit_stats":{"total_commits":38,"total_committers":2,"mean_commits":19.0,"dds":0.3421052631578947,"last_synced_commit":"121b7b95dfabe73e6c28838a5f72f10a22a3bd2d"},"previous_names":["o-nnerb/navigation-kit","brennobemoura/navigation-kit"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/o-nnerb/navigation-kit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o-nnerb%2Fnavigation-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o-nnerb%2Fnavigation-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o-nnerb%2Fnavigation-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o-nnerb%2Fnavigation-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/o-nnerb","download_url":"https://codeload.github.com/o-nnerb/navigation-kit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o-nnerb%2Fnavigation-kit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29688217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T15:51:39.154Z","status":"ssl_error","status_checked_at":"2026-02-21T15:49:03.425Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["declarative","ios","navigation","swift","swift-package-manager","swiftui","tca"],"created_at":"2024-09-24T21:40:57.310Z","updated_at":"2026-02-21T17:03:52.518Z","avatar_url":"https://github.com/o-nnerb.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Swift Compatibility](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fo-nnerb%2Fnavigation-kit%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/o-nnerb/navigation-kit)\n[![Platform Compatibility](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fo-nnerb%2Fnavigation-kit%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/o-nnerb/navigation-kit)\n[![codecov](https://codecov.io/gh/o-nnerb/navigation-kit/branch/main/graph/badge.svg?token=C1KZ4624FC)](https://codecov.io/gh/o-nnerb/navigation-kit)\n\n# NavigationKit\n\nThe NavigationKit is a library thats extends SwiftUI implementation for\nNavigationStack (iOS 16+ only) and adds more resources to managed the\nuser interface.\n\n## Installation\n\nThis repository is distributed through SPM, being possible to use it \nin two ways:\n\n1. Xcode\n\nIn Xcode 14, go to `File \u003e Packages \u003e Add Package Dependency...`, then paste in \n`https://github.com/o-nnerb/navigation-kit.git`\n\n2. Package.swift\n\n```swift\n// swift-tools-version: 5.7\nimport PackageDescription\n\nlet package = Package(\n    name: \"MyPackage\",\n    products: [\n        .library(\n            name: \"MyPackage\",\n            targets: [\"MyPackage\"]\n        )\n    ],\n    dependencies: [\n        .package(url: \"https://github.com/o-nnerb/navigation-kit.git\", from: \"1.0.0\")\n    ],\n    targets: [\n        .target(\n            name: \"MyPackage\",\n            dependencies: [\"NavigationKit\"]\n        )\n    ]\n)\n```\n\n## Usage\n\nThe main features available are the ones listed down below. For each one there is\na problem solving solution that was developed thinking to solve the coupled SwiftUI's\nView \n\n### NKNavigationStack\n\n```swift\n\nstruct ContentView: View {\n\n    var body: some View {\n        NKNavigationStack {\n            FirstView()\n        }\n    }\n}\n```\n\nUsing the NKNavigationStack replaces the NavigationPath with NavigationAction\nthat allows developers to manipulate in a better way the current stacked views.\n\n⚠️ The downside of this implementation is the removal of Decode option that Apple\noffers to us. But you can still implement your own version of NavigationStack\nwith NavigationPath and use the NavigationKit without the NavigationAction \nenvironment.\n\n```swift\nstruct FirstView: View {\n\n    @Environment(\\.navigationAction) var navigationAction\n    \n    var body: some View {\n        Button(\"Push\") {\n            // SomeModel needs to be mapped using\n            // navigationDestination(for:destination:)\n            // using SwiftUI's method.\n            navigationAction.append(SomeModel())\n        }\n    }\n}\n```\n\n### ViewResolver\n\n```swift\nstruct FirstView: View {\n\n    @Environment(\\.viewResolver) var viewResolver\n    \n    var body: some View {\n        // SomeModel needs to be mapped using\n        // viewResolver(for:_:) {}.\n        viewResolver(SomeModel())\n    }\n}\n```\n\nTo map the model with the corresponding view, it's available\nthe viewResolver(for:\\_:) that needs to be specified one\nview before the usage.\n\n```swift\nstruct ContentView: View {\n\n    var body: some View {\n        NKNavigationStack {\n            FirstView()\n                .viewResolver(for: SomeModel.self) {\n                    SecondView($0)\n                }\n        }\n    }\n}\n```\n\n### SceneAction\n\n```swift\nstruct FirstView: View {\n\n    @Environment(\\.sceneAction) var sceneAction\n    \n    var body: some View {\n        Button(\"Push\") {\n            // SomeModel needs to be mapped using\n            // sceneAction(for:perform:) and\n            // the sceneActionEnabled() called in the root\n            // hierarchy.\n            sceneAction(SomeModel())\n        }\n    }\n}\n```\n\nTo map the action it's necessary to call the sceneAction(for:perform:) method\nwhich will capture the action thrown in every place that it might be listened.\n\n⚠️ SceneAction environment is only available when sceneActionEnabled() method is\ncalled before.\n\n```swift\nstruct ContentView: View {\n\n    var body: some View {\n        NKNavigationStack {\n            FirstView()\n        }\n        .sceneAction(for: SomeModel.self) {\n            print(\"Action received: \\($0)\")\n        }\n        // but, sceneActionEnabled is needed before \n        // somewhere in the application\n        .sceneActionEnabled()\n    }\n}\n```\n\nSuggestion: call sceneActionEnabled in App's body property.\n\n### ViewModelConnection\n\nThe ViewModelConnection makes possible to connect a ViewModel into a\nView keeping the SwiftUI State sync and upright.\n\nThis implementation was design to be used inside Coordinator struct.\n\n```swift\nstruct SecondCoordinator: View {\n\n    let model: SomeModel\n    \n    var body: some View {\n        ViewModelConnection(model, SecondViewModel.init) { viewModel in\n            SecondView(viewModel: viewModel)\n        }\n    }\n}\n```\n\nTo managed the flow as Coordinator was meant to be, you need to specify the\ndestination property for the ViewModel as you can work like this:\n\n```swift\nstruct SecondCoordinator: View {\n\n    let model: SomeModel\n    \n    var body: some View {\n        ViewModelConnection(model, SecondViewModel.init) { viewModel in\n            SecondView(viewModel: viewModel)\n                .onReceive(viewModel.$destination) { destination in\n                    switch destination {\n                    case .error(let error):\n                        errorScene(error)\n                    case .third(let third):\n                        thirdScene(third)\n                    case .none:\n                        break\n                    }\n                }\n        }\n    }\n}\n```\n\nInside the errorScene or thirdScene you can call the navigationAction or\nsceneAction to perform something.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fo-nnerb%2Fnavigation-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fo-nnerb%2Fnavigation-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fo-nnerb%2Fnavigation-kit/lists"}