k-arindam/awesomenavigation
**AwesomeNavigation** is a lightweight and elegant SwiftUI navigation library designed to make routing in iOS/macOS apps simple, declarative, and centralized — all while retaining native SwiftUI performance and flexibility.
✨ Features
- 🚦 Centralized Navigation Management using a shared singleton or injectable instance.
- 🛝 Type-safe Route Definition using the
ANRouteprotocol. - ↺ Push, Pop, PushReplacement, PopToRoot — all made easy.
- 🔧 Configurable Root and Transitions via
ANConfig. - 💡 Declarative API that fits naturally into SwiftUI’s ecosystem.
- ⚡ Swift Package ready for seamless integration.
🎞 Installation
Use Swift Package Manager:
In Xcode:
- Open your project.
- Go to File > Add Packages…
- Enter the repository URL:
`` https://github.com/k-arindam/AwesomeNavigation.git ``
- Add the package and import it where needed:
``swift import AwesomeNavigation ``
🚀 Getting Started
Step 1: Define your routes
[Route]
Step 2: Initialize the app with a config
[App]
📌 Core Components
AwesomeNavigation
A shared or injectable navigation controller that holds and manipulates the NavigationPath.
ANRoute
Protocol to define your route types. Conforming types must be Hashable, Codable, and Sendable.
ANConfig
Configuration for your application including:
- Initial route
- Animation style
- Route-to-View builder closure
ANApplication
Entry-point View that wraps NavigationStack and injects navigation environment.
📈 Future Scope
Here are a few exciting features planned for upcoming releases:
- [ ] 🥪 Unit-testable navigation by allowing injection of
AwesomeNavigation(non-singleton mode) - [ ] 🔍 Deep linking support via pre-filled
NavigationPath - [ ] 🧱 Scoped navigation contexts (multiple stacks in one app)
- [ ] 🛡️ Interception hooks (e.g.,
onRouteWillPush, auth guards, analytics) - [ ] 🧑💻 DevTools-style route inspector/debug overlay
- [ ] 📱 iPad/macOS optimized UI state sync (split views, multiple windows)
🛠 Contributing
Pull requests are welcome! Feel free to open issues for bug reports or feature suggestions.
📄 Legal
🙌 Acknowledgements
Inspired by:
- SwiftUI's native navigation stack
- Navigator paradigms from Flutter and React Router
❤️ Example App
A demo implementation is included in the Example/ folder.
@main
struct AwesomeNavigationExampleApp: App {
...
}Banner image created by Canva AI
Package Metadata
Repository: k-arindam/awesomenavigation
Default branch: main
README: README.md