Tests Swift 6.3 iOS 17+ Class A
Departure is a robust, expressive routing framework for SwiftUI.
Declare the destinations a screen owns. Request them from wherever the userβs intent starts. Departure finds the closest eligible owner, presents with the right style, and gives actions a route-aware place to run.
- Push, sheet, and cover routes from one small API.
- Keep domain routes independent from the feature modules that build their views.
- Preserve navigation state across tabs and other selection-based containers.
- Reroute guarded flows, unwind precisely, and intercept route-scoped actions.
- Raise a critical flow above the app when it truly cannot wait.
await router.present(SettingsRoute())
Departure requires Swift 6.3+, supports iOS 17+ and macOS 14+, and is available through Swift Package Manager.
dependencies: [ .package(url: "https://github.com/mtzaquia/departure.git", from: "2.0.3"), ],
Install WithRouter, make a route, declare how HomeView presents it, then request it.
@main struct ExampleApp: App { var body: some Scene { WindowGroup { WithRouter { NavigationStack { HomeView() } } } } } struct SettingsRoute: Route { func destination() -> some View { SettingsView() } } struct SettingsView: View { var body: some View { Text("Settings") } } struct HomeView: View { @Environment(Router.self) private var router var body: some View { Button("Settings") { Task { await router.present(SettingsRoute()) } } .routes { Sheet(SettingsRoute.self) } } }
Thatβs the core idea: the screen that owns the presentation declares it; the screen that starts the flow simply asks for the route.
Routes may also omit destination() and let a feature module supply the view through
RouteViewProviding. See Routing for the
module layout and fallback behavior.
Note
Declare Push(...) inside a NavigationStack.
- Getting started β setup, routes, and declarations.
- Routing β presentation styles, ownership, and guarded routes.
- Actions β route-aware work and interception.
- Unwinding β dismissing flows and returning values.
- Branches β routing in tabs and other selection containers.
- Priority β high- and critical-priority presentations.
Copyright (c) 2026 @mtzaquia
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.