Skip to main content

PrismRouter

PrismRouter is an observable navigation manager that provides type-safe routing with push, sheet, and full-screen cover presentations. It bridges PrismArchitecture with SwiftUI’s navigation system.

Defining Routes

Routes must conform to PrismRoutable (which requires Hashable and Identifiable):
Route Definition

Creating a Router

Creating a Router

Push (Navigation Stack)

Push Navigation

Sheet Presentation

Sheet

Full-Screen Cover

Full Screen

Dismissing

Dismiss

Inspecting State

Router State

SwiftUI Integration

Use PrismNavigationView from PrismUI to connect the router to SwiftUI’s navigation:
PrismNavigationView
PrismNavigationView binds the router’s path to a NavigationStack, and presents sheets and full-screen covers automatically.

Using with PrismStore

Integrate routing into your architecture by including the router as state or passing it alongside the store:
Router in Architecture
PrismRouter is @Observable and Equatable. SwiftUI views that reference it re-render only when the navigation state actually changes.

Deep Linking

Build a navigation path from a URL for deep linking:
Deep Linking
PrismNavigationStyle defines the presentation style for a route: