{"id":25930290,"url":"https://github.com/nikolainobadi/swiftuinavdestinationbug","last_synced_at":"2026-05-07T20:46:37.669Z","repository":{"id":280048275,"uuid":"940839596","full_name":"nikolainobadi/SwiftUINavDestinationBug","owner":"nikolainobadi","description":"A SwiftUI project demonstrating a bug where nested navigation fails.","archived":false,"fork":false,"pushed_at":"2025-02-28T22:26:31.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T00:33:03.380Z","etag":null,"topics":["bug","swift","swiftui","swiftui-demo","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/nikolainobadi.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-28T22:23:07.000Z","updated_at":"2025-02-28T22:26:34.000Z","dependencies_parsed_at":"2025-03-01T00:33:07.136Z","dependency_job_id":"45e0c232-b36a-4712-8576-a523fccc4a4c","html_url":"https://github.com/nikolainobadi/SwiftUINavDestinationBug","commit_stats":null,"previous_names":["nikolainobadi/swiftuinavdestinationbug"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolainobadi%2FSwiftUINavDestinationBug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolainobadi%2FSwiftUINavDestinationBug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolainobadi%2FSwiftUINavDestinationBug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolainobadi%2FSwiftUINavDestinationBug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikolainobadi","download_url":"https://codeload.github.com/nikolainobadi/SwiftUINavDestinationBug/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241753170,"owners_count":20014251,"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","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":["bug","swift","swiftui","swiftui-demo","xcode"],"created_at":"2025-03-03T23:01:12.492Z","updated_at":"2026-05-07T20:46:37.631Z","avatar_url":"https://github.com/nikolainobadi.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftUINavDestinationBug  \n\nThis project demonstrates a bug in SwiftUI related to nested navigation when using different `.navigationDestination` modifers in the same hierarchy.  \n\n## Overview  \n\nThe app consists of two tabs:  \n\n- **\"Ok\" Tab** (Green)  \n  - Uses `NavigationPath` to navigate to `ItemRouteChildStack`.  \n  - Further navigation inside `ItemRouteChildStack` using `NavigationLink` works as expected.  \n\n- **\"Bug\" Tab** (Red)  \n  - Uses `.navigationDestination(item:)` to navigate to `ItemRouteChildStack`.  \n  - Further navigation inside `ItemRouteChildStack` using `NavigationLink` does not work.  \n\n## Reproducing the Issue  \n\n1. Run the app.  \n2. In the **\"Ok\" Tab**, tap the button.  \n   - The app navigates to `ItemRouteChildStack`.  \n   - Selecting any item in the list successfully navigates to another view.  \n3. In the **\"Bug\" Tab**, tap the button.  \n   - The app navigates to `ItemRouteChildStack`.  \n   - Selecting any item in the list does **not** navigate to a new view.  \n\n## Code Breakdown  \n\n### Working Navigation (Uses `NavigationPath`) \n```swift\nstruct ContentView: View {\n    @State private var path = NavigationPath()\n\n    var body: some View {\n        NavigationStack(path: $path) {\n            Button(\"this path works\") {\n                path.append(MyItem(name: \"something\"))\n            }\n            .navigationDestination(for: MyItem.self) { myItem in\n                ItemRouteChildStack(item: myItem)\n            }\n        }\n    }\n}\n```\n\n- `NavigationPath` correctly manages navigation state.\n- Further navigation inside `ItemRouteChildStack` works.\n\n### Broken Navigation (Uses .navigationDestination(item:))\n```swift \nstruct BugContentView: View {\n    @State private var myItem: MyItem?\n\n    var body: some View {\n        NavigationStack {\n            Button(\"This path is broken\") {\n                myItem = MyItem(name: \"something\")\n            }\n            .navigationDestination(item: $myItem) { myItem in\n                ItemRouteChildStack(item: myItem)\n            }\n        }\n    }\n}\n```\n- The initial navigation works.\n- However, further navigation inside `ItemRouteChildStack` fails.\n\n## Expected Behavior  \n\nBoth approaches should allow further navigation inside `ItemRouteChildStack`.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikolainobadi%2Fswiftuinavdestinationbug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikolainobadi%2Fswiftuinavdestinationbug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikolainobadi%2Fswiftuinavdestinationbug/lists"}