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 UUID identifiers 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

    item

    A Destination identifier to be added to the path.

    shouldAnimate

    Determines whether this path element should be animated when presented.

  • currentPathElement() Default implementation

    Returns the current path element. Typically this would be the identifier associated with a Destinationable object.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func currentPathElement() -> UUID?

    Return Value

    A UUID identifier of the associated element.

  • 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

    previousPresentationID

    An 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

    identifier

    A UUID identifier 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 implementation

    Returns the previous path element.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func previousPathElement() -> UUID?

    Return Value

    A UUID identifier 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

    element

    The identifier

    Return Value

    The position of the element, if it exists in the path.

  • removeAll() Default implementation

    Removes all path elements from the navigation path.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func removeAll()
  • Undocumented

    Declaration

    Swift

    @MainActor
    func addPathElement(item: UUID, shouldAnimate: Bool = true)