NavigationSplitViewDestinationable

@MainActor
public protocol NavigationSplitViewDestinationable<PresentationConfiguration> : GroupedDestinationable, ViewDestinationable where Self.ViewType : NavigationSplitViewDestinationInterfacing

This protocol represents a Destination whose interface View handles a NavigationSplitView.

  • A dictionary of View-based Destination object identifiers, whose associated keys are the NavigationSplitViewColumn column type should be displayed in.

    Declaration

    Swift

    @MainActor
    var destinationIDsForColumns: [NavigationSplitViewColumn : UUID] { get set }
  • A reference to the View currently used in the sidebar column of this Destination’s associated NavigationSplitView. This property is updated when a new View is presented in the column.

    To implement this in your View and enable dynamic updating of your NavigationSplitView‘s column, bind this property from inside the sidebar column’s closure using a BindableContainerView.

    Example:

    NavigationSplitView(columnVisibility: $columnVisibility) {
        BindableContainerView(content: $destinationState.destination.currentSidebar)
    } content: {
        BindableContainerView(content: $destinationState.destination.currentContent)
    } detail: {
        BindableContainerView(content: $destinationState.destination.currentDetail)
    }
    

    Declaration

    Swift

    @MainActor
    var currentSidebar: ContainerView<AnyView> { get set }
  • A reference to the View currently used in the content column of this Destination’s associated NavigationSplitView. This property is updated when a new View is presented in the column.

    To implement this in your View and enable dynamic updating of your NavigationSplitView‘s column, bind this property from inside the content column’s closure using a BindableContainerView.

    Example:

    NavigationSplitView(columnVisibility: $columnVisibility) {
        BindableContainerView(content: $destinationState.destination.currentSidebar)
    } content: {
        BindableContainerView(content: $destinationState.destination.currentContent)
    } detail: {
        BindableContainerView(content: $destinationState.destination.currentDetail)
    }
    

    Declaration

    Swift

    @MainActor
    var currentContent: ContainerView<AnyView> { get set }
  • A reference to the View currently used in the detail column of this Destination’s associated NavigationSplitView. This property is updated when a new View is presented in the column.

    To implement this in your View and enable dynamic updating of your NavigationSplitView‘s column, bind this property from inside the detail column’s closure using a BindableContainerView.

    Example:

    NavigationSplitView(columnVisibility: $columnVisibility) {
        BindableContainerView(content: $destinationState.destination.currentSidebar)
    } content: {
        BindableContainerView(content: $destinationState.destination.currentContent)
    } detail: {
        BindableContainerView(content: $destinationState.destination.currentDetail)
    }
    

    Declaration

    Swift

    @MainActor
    var currentDetail: ContainerView<AnyView> { get set }
  • Presents a Destination in a NavigationSplitView column.

    Note

    This method will throw an error if the requested column is not found.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func presentDestination(destination: any ViewDestinationable<PresentationConfiguration>, in column: NavigationSplitViewColumn, shouldUpdateSelectedColumn: Bool, presentationOptions: NavigationStackPresentationOptions?, removeDestinationFromFlowClosure: RemoveDestinationFromFlowClosure?)

    Parameters

    destination

    A SwiftUI-based Destination to be presented.

    column

    The column to present this Destination in.

    shouldUpdateSelectedColumn

    Determines whether the column should become the current one.

  • column(destinationID:) Default implementation

    Returns a column type if it finds a Destination identifier which matches the root Destination for that column.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func column(destinationID: UUID) -> NavigationSplitViewColumn?

    Parameters

    destinationID

    A Destination identifier representing the root Destination of a column.

    Return Value

    A split view column type, if a matching Destination identifier was supplied.

  • currentDestination(for:) Default implementation

    Returns the current Destination for the specified colunn. In the case where multiple Destinations are presented in a column, it will return the most recently-presented (visible) one.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func currentDestination(for column: NavigationSplitViewColumn) -> (any ViewDestinationable<PresentationConfiguration>)?

    Parameters

    column

    The column type.

    Return Value

    A View-based Destination, if one was found.

  • rootDestination(for:) Default implementation

    Returns the root Destination for the column. This is not necessarily the Destination representing the currently visible View in a column, but is instead the View which is at the column’s root level, such as a NavigationStack.

    This method should be used when building the column for a NavigationSplitView.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func rootDestination(for column: NavigationSplitViewColumn) -> (any ViewDestinationable<PresentationConfiguration>)?

    Parameters

    column

    The column type.

    Return Value

    A Destination, if one was found.

  • updateChildren() Extension method

    Declaration

    Swift

    @MainActor
    func updateChildren()
  • Declaration

    Swift

    @MainActor
    func replaceChild(currentID: UUID, with newDestination: any Destinationable<PresentationConfiguration>, removeDestinationFromFlowClosure: RemoveDestinationFromFlowClosure? = nil)