这是indexloc提供的服务,不要输入任何密码
Skip to content

ahmedgado95/NavigationStack

Repository files navigation

🧭 SwiftUI NavigationStack Coordinator

A generic Coordinator pattern built on top of SwiftUI’s NavigationStack.
This repo demonstrates how to manage push / pop / sheets / fullScreen modals in a clean, centralized, and type-safe way.

📖 Medium Article: Read here


✨ Features

  • 📌 Generic Coordinator with type-safe routes (Hashable & Identifiable)
  • 🚀 Centralized push / pop / popTo / popToRoot navigation
  • 🪟 Built-in support for Sheets and FullScreenCovers
  • ♻️ Fully reusable across different projects
  • 🧩 Clean separation between UI and Navigation Logic

🎥 Screenshot

Simulator.Screen.Recording.-.iPhone.17.Pro.-.2025-10-03.at.19.18.11.mov

🏗️ Project Structure

├── Coordinator.swift         # The generic Coordinator
├── CoordinatorView.swift     # Root container using NavigationStack
├── Screen.swift              # Enum with all app routes
├── HomeView.swift            # Example screen with navigation actions
├── HomeViewModel.swift       # ViewModel handling Coordinator calls
├── HomeViewModelTests.swift  # Unit tests for HomeViewModel
└── NavigationStackApp.swift  # App entry point

🛠 Setup

Requirements

  • Xcode 16+
  • Swift 5.9+

Installation

Clone the repository:

git clone https://github.com/ahmedgado95/NavigationStack.git

Open the project in Xcode 16+ and run it.


🎯 Why Use This?

✅ Keeps navigation centralized (no more scattered logic)

✅ Views remain focused on UI, not navigation

✅ Type-safe routes

✅ Makes large SwiftUI apps easier to scale and maintain


🤝 Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.


🌟 Support

If you find this project helpful, give it a ⭐ on GitHub!

Made with ❤️ by Ahmed Gado

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages