Navigation
Learn how to use the navigation tools in the library, including how to best model your domains, how to integrate features in the reducer and view layers, and how to write tests.
Overview
State-driven navigation is a powerful concept in application development, but can be tricky to master. The Composable Architecture provides the tools necessary to model your domains as concisely as possible and drive navigation from state, but there are a few concepts to learn in order to best use these tools.
Essentials
What is navigation?
Learn about the two main forms of state-driven navigation, tree-based and stack-based navigation, as well as their tradeoffs.
Read More
Tree-based navigation
Tree-based navigation
Learn about tree-based navigation, that is navigation modeled with optionals and enums, including how to model your domains, how to integrate features, how to test your features, and more.
Read Moremacro Presents(
) Wraps a property with
PresentationState
and observes it.enum PresentationAction<Action>
A wrapper type for actions that can be presented.
Reducer/ifLet(_:action:destination:fileID:filePath:line:column:)-4ub6q
Stack-based navigation
Stack-based navigation
Learn about stack-based navigation, that is navigation modeled with collections, including how to model your domains, how to integrate features, how to test your features, and more.
Read Morestruct StackState<Element>
A list of data representing the content of a navigation stack.
enum StackAction<State, Action>
A wrapper type for actions that can be presented in a navigation stack.
typealias StackActionOf<R>
A convenience type alias for referring to a stack action of a given reducer’s domain.
struct StackElementID
An opaque type that identifies an element of
StackState
.Reducer/forEach(_:action:destination:fileID:filePath:line:column:)-9svqb
Dismissal
struct DismissEffect
An effect that dismisses the current presentation.
var dismiss: DismissEffect
An effect that dismisses the current presentation.
var isPresented: Bool
A Boolean value that indicates whether the current feature is being presented from a parent feature.