{"id":24335813,"url":"https://github.com/ernest0-production/screennavigatorkit","last_synced_at":"2025-08-02T10:33:48.584Z","repository":{"id":47480888,"uuid":"482527537","full_name":"Ernest0-Production/ScreenNavigatorKit","owner":"Ernest0-Production","description":"Framework that provide convenient environment for manage navigation in SwiftUI","archived":false,"fork":false,"pushed_at":"2024-01-01T18:17:56.000Z","size":38,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-26T19:20:46.256Z","etag":null,"topics":["ios","spm","swift","swiftui","xcode"],"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/Ernest0-Production.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-04-17T13:15:32.000Z","updated_at":"2024-03-11T12:47:22.000Z","dependencies_parsed_at":"2024-01-01T19:38:38.656Z","dependency_job_id":null,"html_url":"https://github.com/Ernest0-Production/ScreenNavigatorKit","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"ba712d157d667fb11eeda54b76e902b9e9e66c13"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Ernest0-Production/ScreenNavigatorKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ernest0-Production%2FScreenNavigatorKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ernest0-Production%2FScreenNavigatorKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ernest0-Production%2FScreenNavigatorKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ernest0-Production%2FScreenNavigatorKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ernest0-Production","download_url":"https://codeload.github.com/Ernest0-Production/ScreenNavigatorKit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ernest0-Production%2FScreenNavigatorKit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268371517,"owners_count":24239791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ios","spm","swift","swiftui","xcode"],"created_at":"2025-01-18T05:35:37.736Z","updated_at":"2025-08-02T10:33:48.549Z","avatar_url":"https://github.com/Ernest0-Production.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://img.shields.io/badge/Platform%20Compatibility-iOS%2014-orange) ![](https://img.shields.io/badge/Swift%20Compatibility-5.3%2B-orange)\n![](https://img.shields.io/badge/manager-SPM-orange)\n\n# ScreenNavigatorKit\n\nFramework that provide convenient environment for manage navigation in SwiftUI.\n\n##  Pros:\n- 🤢 No boolean flag such as `@State var isActive`\n- 🤮 No `enum` flag  such as `@State var route: RouteAction?` with big `switch-case` statement\n- 🤡 No implicit `UIKit` hacks with `UIViewController`\n- 💩 No singleton/shared/global presenter of application\n\n### 🔩 Requirements\n\n- iOS 14.0+\n- Xcode 12.0+\n- Swift 5.3+\n\n# 🧐 How does it work?!\n\nFramework has only two `state object`, each of which isolates \"toggle-work\" of `@State var isActive: Bool` and `@State var isPresent: Bool` flags.\n\n## 1. `NavigationStackController`\n\nLike `UINavigationController`, it **store stack state** and **provide stack transformation** using `push` and `pop` methods:\n```swift\nlet navigationStackController = NavigationStackController()\n\n// Standard usage\n\nnavigationStackController.push(Text(\"My View\"))\nnavigationStackController.pop()\nnavigationStackController.popToRoot()\n\n// Advanced usage\n\nenum Screen: Hashable { \n    case detail\n    ...\n}\n\nnavigationStackController.push(tag: Screen.detail, DetailView())\nnavigationStackController.pop(to: Screen.detail)\n```\nIts companion is `NavigationStackView` – wrapper over `NavigationView` that bind `NavigationStackController` with it:\n```swift\nstruct ContentView: View { \n    @StateObject var navigationStackController = NavigationStackController() \n\n    var body: some View { \n        NavigationStackView(navigationStackController) { \n            RootView(\n                showDetails: { model in \n                    navigationStackController.push(DetailView(model: model))\n                },\n                showSettings: { \n                    navigationStackController.push(SettingsView())\n                }\n            )\n        }\n    }\n}\n\n// Another usage with automatic initialized NavigationStackController\n\nstruct ContentView: View { \n    var body: some View { \n        NavigationStackView { controller in\n            RootView(\n                showDetails: { model in \n                    controller.push(DetailView(model: model))\n                },\n                showSettings: { \n                    controller.push(SettingsView())\n                }\n            )\n        }\n    }\n}\n```\n\nAny pushed view has access to `NavigationStackController` of `NavigationStackView` through `EnvironmentObject`:\n```swift\nstruct DetailView: View { \n    let model: Model\n    @EnvironmentObject var navigationStackController: NavigationStackController\n\n    var body: some View { \n        VStack { \n            Text(model.title)\n            Button(\"pop to root\") { \n                navigationStackController.popToRoot()\n            }\n        }\n    }\n}\n```\n**💫 EXTRA FEATURE:** You can tag any pushed view using any `Hashable` type. It allow refer to specific screen on pop:\n```swift\nnavigationStackController.push(tag: \"Screen 1\", Screen1()))\nnavigationStackController.pop(to: \"Screen 1\")\n```\n\n## 2. `ModalStackController`\n\nLike `NavigationStackController`, the `ModalStackController` **control modal stack hierarchy** and **provide stack transformation** using `present` and `dismiss` methods:\n```swift\nlet modalStackController = ModalStackController()\n\n// Standard usage\n\nmodalStackController.present(.sheet, Text(\"My View\"))\nmodalStackController.present(.fullScreenCover, Text(\"Another View\"))\nmodalStackController.dismiss()\nmodalStackController.dismissAll()\n\n// Advanced usage\n\nenum Screen: Hashable { \n    case detail\n    ...\n}\n\nmodalStackController.present(.sheet, tag: Screen.detail, DetailView())\nmodalStackController.dismiss(to: Screen.detail)\n```\n\n**🚧 NOTE:** `SwiftUI` does not allow to dismiss multiple views at once! Therefore, methods such as `dismissAll()` or `dismiss(to:)`/`dismiss(from:)` will close all views **sequentially**. \n\nIts companion is `ModalStackView` that bind `ModalStackController` with it:\n```swift\nstruct ExampleApp: App { \n    @StateObject var modalStackController = ModalStackController()\n\n    var body: some Scene { \n        WindowGroup {\n            ModalStackView(modalStackController) { \n                RootView()\n            }\n        }\n    }\n}\n```\nAny presented view has access to `ModalStackController` through `EnvironmentObject` too:\n```swift\nstruct RootView: View { \n    @EnvironmentObject var modalStackController: ModalStackController\n\n    var body: some View { \n        VStack { \n            Text(\"Home screen\")\n            Button(\"FAQ\") { \n                modalStackController.present(.sheet, FAQView())\n            }\n            Button(\"Authorize\") { \n                modalStackController.present(.fullScreenCover, LoginView())\n            }\n        }\n    }\n}\n```\n\u003e 💫 Just like in `NavigationStackController` you can tag presented views when present with `ModalStackController`\n\n# API\n`NavigationStackController`\n- push\n- push(tag:)\n- pop\n- pop(tag:)\n- popLast(_ k:)\n- popToRoot\n\n`ModalStackController`\n- present(_ presentationStyle:)\n- present(_ presentationStyle:tag:)\n- dismiss\n- dismiss(tag:)\n- dismissLast(_ k:)\n- dismissAll\n- `PresentationStyle`\n    - sheet\n    - fullScreenCover\n\n# FAQ\n\n### Can i mix this framework with existing navigation approach in my project?\n\n**Yes, you can**. The framework does not affect navigation built in other ways, such as through the standard `@State var isActive: Bool` flags or through UIKit hacks.\\\n`NavigationStackController` and `ModalStackController` create local state and manage only their own state.\n\n### What about `Alert`?\n\nUnfortunately, the framework **does not support** such a mechanism for working with `Alert`, BUT **you can implement it yourself by analogy** with `ModalStackController`.\\\nYour project can have many different custom presentations (`popup`, `snackbar`, `toast`, `notifications`) and each of them require specific logic for handle hierarchy, depending on their implementation.\\\nSo adding new presentation methods to the framework **is not planned**.\n\n# 📦 Installation\n\n#### [Swift Package Manager](https://github.com/apple/swift-package-manager)\n\nCreate a `Package.swift` file.\n\n```swift\n// swift-tools-version:5.3\n\nimport PackageDescription\n\nlet package = Package(\n  name: \"YOUR_PROJECT_NAME\",\n  dependencies: [\n      .package(url: \"https://github.com/Ernest0-Production/ScreenNavigatorKit.git\", from: \"0.0.3\")\n  ],\n  targets: [\n      .target(name: \"YOUR_TARGET_NAME\", dependencies: [\"ScreenNavigatorKit\"])\n  ]\n)\n```\n\n### Credits\n\n- [Telegram](https://t.me/Ernest0n)\n\n### License\n\nScreenNavigatorKit is released under the MIT license. See [LICENSE](https://github.com/Ernest0-Production/ScreenNavigatorKit/blob/main/LICENSE.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fernest0-production%2Fscreennavigatorkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fernest0-production%2Fscreennavigatorkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fernest0-production%2Fscreennavigatorkit/lists"}