Use `NavigationTransitionProtocol` to define full navigation flows
mainNavigationTransitionProtocol is the primary interface for defining how a pair of views interact during navigation. It uses a result builder syntax to compose transitions for different lifecycle events.
Commonly, you will implement this protocol by wrapping AtomicTransition types. For example, a Slide implementation might use MirrorPush to coordinate OnInsertion and OnRemoval behaviors for different axes.
Example of a protocol implementation structure:
public struct Slide: NavigationTransitionProtocol {
private let axis: Axis
public init(axis: Axis) {
self.axis = axis
}
public var body: some NavigationTransitionProtocol {
switch axis {
case .horizontal:
MirrorPush {
OnInsertion {
Move(edge: .trailing)
}
OnRemoval {
Move(edge: .leading)
}
}
case .vertical:
MirrorPush {
OnInsertion {
Move(edge: .bottom)
}
OnRemoval {
Move(edge: .top)
}
}
}
}
}