{"id":23581260,"url":"https://github.com/imodeveloperlab/custom-navigation-with-swiftui","last_synced_at":"2026-01-29T10:02:46.397Z","repository":{"id":244407437,"uuid":"815158588","full_name":"imodeveloperlab/Custom-Navigation-with-SwiftUI","owner":"imodeveloperlab","description":"A prototype for creating custom navigations using SwiftUI. It features smooth transitions with `matchedGeometryEffect` and includes the Barbershop project as a practical example to showcase its capabilities.","archived":false,"fork":false,"pushed_at":"2024-06-14T13:52:25.000Z","size":10943,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-16T20:42:35.419Z","etag":null,"topics":["animation","custom-navigation","matched-geometry-effect","swiftui"],"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/imodeveloperlab.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":"2024-06-14T13:29:10.000Z","updated_at":"2025-02-14T06:18:30.000Z","dependencies_parsed_at":"2024-06-14T15:10:12.189Z","dependency_job_id":null,"html_url":"https://github.com/imodeveloperlab/Custom-Navigation-with-SwiftUI","commit_stats":null,"previous_names":["imodeveloper/custom-navigation-with-swiftui","imodeveloperlab/custom-navigation-with-swiftui"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/imodeveloperlab/Custom-Navigation-with-SwiftUI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imodeveloperlab%2FCustom-Navigation-with-SwiftUI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imodeveloperlab%2FCustom-Navigation-with-SwiftUI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imodeveloperlab%2FCustom-Navigation-with-SwiftUI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imodeveloperlab%2FCustom-Navigation-with-SwiftUI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imodeveloperlab","download_url":"https://codeload.github.com/imodeveloperlab/Custom-Navigation-with-SwiftUI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imodeveloperlab%2FCustom-Navigation-with-SwiftUI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28875446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T09:47:23.353Z","status":"ssl_error","status_checked_at":"2026-01-29T09:47:19.357Z","response_time":59,"last_error":"SSL_read: 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":["animation","custom-navigation","matched-geometry-effect","swiftui"],"created_at":"2024-12-27T00:15:15.133Z","updated_at":"2026-01-29T10:02:46.345Z","avatar_url":"https://github.com/imodeveloperlab.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Custom Navigation with SwiftUI\n\n\nThis repository provides a prototype for creating custom navigations using SwiftUI. It features smooth transitions with `matchedGeometryEffect` and includes the Barbershop project as a practical example to showcase its capabilities. This example UI is created using the [DSKit framework](https://github.com/imodeveloperlab/dskit-swiftui), which provides flexible and customizable components for SwiftUI development.\n\n\u003cimg src=\"demo.gif\" width=\"300\"\u003e\n\n## Overview\n\nThis repository contains:\n\n- **Custom Navigation System**: A set of SwiftUI components that enable custom navigation and transitions between views.\n- **Barbershop Project**: A sample project used as a playground to showcase the custom navigation system in action.\n\n## Features\n\n- **Custom Navigation Manager**: Manages the presentation and dismissal of views.\n- **Custom Navigation View**: A container view that handles navigation and transitions.\n- **Custom Navigation Link**: A button that navigates to a new view with a smooth transition.\n- **Matched Geometry Effect**: Creates cohesive and visually appealing transitions between views.\n\n## How It Works\n\n### Custom Navigation Components\n\n1. **CustomNavigationManager**:\n   - Manages the state of the current view and whether a view is being presented.\n   - Methods to present and dismiss views with smooth animations.\n\n2. **CustomNavigationView**:\n   - A container view that displays the main content and handles background color and transitions.\n   - Uses a `ZStack` to overlay views, allowing for smooth transitions.\n\n3. **CustomNavigationLink**:\n   - Provides a button that navigates to a new view when tapped.\n   - Uses `matchedGeometryEffect` to create smooth transitions between the button and the destination view.\n\n### Matched Geometry Effect\n\nThe `matchedGeometryEffect` modifier in SwiftUI allows you to link the geometry of two views, enabling seamless transitions between them. By assigning the same `id` and `namespace` to views, SwiftUI animates the transition in a visually cohesive manner.\n\nIn the custom navigation system, `matchedGeometryEffect` is used in `CustomNavigationLink` to create smooth transitions:\n\n```swift\nlabel\n    .matchedGeometryEffect(\n        id: \"frame\",\n        in: animation,\n        anchor: .top\n    )\n\ndestination\n    .matchedGeometryEffect(\n        id: \"frame\",\n        in: animation,\n        anchor: .top\n    )\n```\n\nThis ensures that when the button is tapped, the transition between the label and the destination view is visually linked and smooth.\n\n## Barbershop Project\n\nThe repository includes the Barbershop project, which serves as a playground to demonstrate the custom navigation system. This sample project showcases how to use the custom navigation components in a real-world scenario, providing a practical example for developers to follow.\n\n## Getting Started\n\n1. **Clone the Repository**:\n   ```sh\n   git clone https://github.com/yourusername/CustomNavigation.git\n   ```\n\n2. **Open the Project**:\n   Open the `Barbershop.xcodeproj` file in Xcode.\n\n3. **Run the Project**:\n   Build and run the project on the simulator or a physical device to see the custom navigation in action.\n\n## Example Usage\n\nHere's a brief example of how to use the custom navigation components in your SwiftUI app:\n\n```swift\nimport SwiftUI\n\nstruct ContentView: View {\n    var body: some View {\n        CustomNavigationView {\n            VStack {\n                Text(\"Home View\")\n                    .font(.largeTitle)\n                \n                CustomNavigationLink(\n                    destination: {\n                        DetailView()\n                    },\n                    label: {\n                        Text(\"Go to Detail\")\n                            .font(.title)\n                            .padding()\n                            .background(Color.blue)\n                            .foregroundColor(.white)\n                            .cornerRadius(8)\n                    }\n                )\n            }\n        }\n    }\n}\n\nstruct DetailView: View {\n    @EnvironmentObject var navigationManager: CustomNavigationManager\n    \n    var body: some View {\n        VStack {\n            Text(\"Detail View\")\n                .font(.largeTitle)\n            \n            Button(action: {\n                navigationManager.dismiss()\n            }) {\n                Text(\"Dismiss\")\n                    .font(.title)\n                    .padding()\n                    .background(Color.red)\n                    .foregroundColor(.white)\n                    .cornerRadius(8)\n            }\n        }\n    }\n}\n```\n\n## License\n\nThis project is licensed under the MIT License.\n\n---\n\nThis repository serves as a prototype and demonstration of how to create custom navigations with SwiftUI, using `matchedGeometryEffect` to enhance transitions. The included Barbershop project provides a practical example, showcasing the custom navigation system in action.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimodeveloperlab%2Fcustom-navigation-with-swiftui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimodeveloperlab%2Fcustom-navigation-with-swiftui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimodeveloperlab%2Fcustom-navigation-with-swiftui/lists"}