DestinationPathNavigating
@MainActor
public protocol DestinationPathNavigating : AnyObject
This protocol represents a Destination navigator path object. It should be implemented to allow for system-level navigation stacks like SwiftUI’s NavigationStack into the Destinations ecosystem, which the DestinationNavigator class implements.
-
An array of
UUIDidentifiers representing Destinations in the associated navigation path.Declaration
Swift
@MainActor var navigationPath: [UUID] { get set } -
The identifier of the current destination presentation.
Declaration
Swift
@MainActor var currentPresentationID: UUID? { get set } -
The identifier of the Destination associated with this navigator.
Declaration
Swift
@MainActor var navigatorDestinationID: UUID? { get set } -
Adds a Destination to the path.
Declaration
Swift
@MainActor func addPathElement(item: UUID, shouldAnimate: Bool?)Parameters
itemA Destination identifier to be added to the path.
shouldAnimateDetermines whether this path element should be animated when presented.
-
currentPathElement()Default implementationReturns the current path element. Typically this would be the identifier associated with a
Destinationableobject.Default Implementation
Declaration
Swift
@MainActor func currentPathElement() -> UUID?Return Value
A
UUIDidentifier of the associated element. -
backToPreviousPathElement(previousPresentationID:Default implementation) Removes the current navigation element and makes the previous element in the path the current element.
Default Implementation
Declaration
Swift
@MainActor func backToPreviousPathElement(previousPresentationID: UUID?)Parameters
previousPresentationIDAn optional unique identifier of the previous destination.
-
backToElement(identifier:Default implementation) Removes all previous elements, from the current navigation element until the element matching the specified identifier.
Default Implementation
Declaration
Swift
@MainActor func backToElement(identifier: UUID) -> [UUID]Parameters
identifierA
UUIDidentifier that specifies which element should become the current identifer after removing elements ahead of it.Return Value
An array representing the remaining navigation elements of the path after removals.
-
previousPathElement()Default implementationReturns the previous path element.
Default Implementation
Declaration
Swift
@MainActor func previousPathElement() -> UUID?Return Value
A
UUIDidentifier of the previous path element. -
index(of:Default implementation) Returns the index of the supplied element identifier, it is is present in the path.
Default Implementation
Declaration
Swift
@MainActor func index(of identifier: UUID) -> Int?Parameters
elementThe identifier
Return Value
The position of the element, if it exists in the path.
-
removeAll()Default implementationRemoves all path elements from the navigation path.
Default Implementation
Declaration
Swift
@MainActor func removeAll() -
addPathElement(item:Extension methodshouldAnimate: ) Undocumented
Declaration
Swift
@MainActor func addPathElement(item: UUID, shouldAnimate: Bool = true)
View on GitHub