SkillAgentSearch skills...

NavigationController

No description available

Install / Use

/learn @bannzai/NavigationController
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

NavigationController

NavigationController is a Swift Package designed to simplify and efficiently manage navigation within SwiftUI applications. Leveraging SwiftUI's NavigationStack and NavigationPath, it aims to make the implementation of navigation flows between screens as straightforward as possible. This package is created with the goal of

Features

  • Simple API for implementing navigation transitions
  • Utilizes SwiftUI's NavigationStack and NavigationPath for navigation management
  • Supports sharing navigation state across multiple screens
  • Facilitates programmatic navigation between views

Installation

Swift Package Manager

NavigationController can be added to your project using the Swift Package Manager. In Xcode, select "File" > "Swift Packages" > "Add Package Dependency..." and enter the following repository URL:

Usage

To use NavigationController, apply the WithNavigationModifier modifier to the SwiftUI view you want to manage navigation for. Then, control the navigation between screens using instances of NavigationController.

struct ContentView: View {
  var body: some View {
    RootView()
      .withNavigation()
  }
}

struct RootView: View {
  // Retrieve navigationController via EnvironmentObject
  @EnvironmentObject var navigationController: NavigationController

  var body: some View {
    VStack {
      // Use navigationController ...
    }
  }
}

To push a screen:

Button {
  navigationController.push { 
    YourDestinationView() 
  }
} label: {
  Text("Push")
}

To pop a screen

Button {
  navigationController.pop()
} label: {
  Text("Pop")
}

Edit path directly. For example edit path and pop.

Button {
  navigationController.path.removeLast()
} label: {
  Text("Edit path and pop")
}

LICENSE

NavigationController is released under the MIT License. For more details, please see the LICENSE file.

View on GitHub
GitHub Stars38
CategoryDevelopment
Updated3d ago
Forks1

Languages

Swift

Security Score

85/100

Audited on Mar 25, 2026

No findings