NavigationSplitViewDestinationable
@MainActor
public protocol NavigationSplitViewDestinationable<DestinationType, ContentType, TabType> : GroupedViewDestinationable 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 theNavigationSplitViewColumncolumn type should be displayed in.Declaration
Swift
@MainActor var destinationIDsForColumns: [NavigationSplitViewColumn : UUID] { get set } -
A reference to the
Viewcurrently used in thesidebarcolumn of this Destination’s associatedNavigationSplitView. This property is updated when a newViewis presented in the column.To implement this in your
Viewand enable dynamic updating of yourNavigationSplitView‘s column, bind this property from inside thesidebarcolumn’s closure using aBindableContainerView.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
Viewcurrently used in thecontentcolumn of this Destination’s associatedNavigationSplitView. This property is updated when a newViewis presented in the column.To implement this in your
Viewand enable dynamic updating of yourNavigationSplitView‘s column, bind this property from inside thecontentcolumn’s closure using aBindableContainerView.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
Viewcurrently used in thedetailcolumn of this Destination’s associatedNavigationSplitView. This property is updated when a newViewis presented in the column.To implement this in your
Viewand enable dynamic updating of yourNavigationSplitView‘s column, bind this property from inside thedetailcolumn’s closure using aBindableContainerView.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 } -
presentDestination(destination:Default implementationin: shouldUpdateSelectedColumn: presentationOptions: removeDestinationFromFlowClosure: ) Presents a Destination in a
NavigationSplitViewcolumn.Note
This method will throw an error if the requested column is not found.Default Implementation
Declaration
Swift
@MainActor func presentDestination(destination: any ViewDestinationable<DestinationType, ContentType, TabType>, in column: NavigationSplitViewColumn, shouldUpdateSelectedColumn: Bool, presentationOptions: NavigationStackPresentationOptions?, removeDestinationFromFlowClosure: RemoveDestinationFromFlowClosure?)Parameters
destinationA SwiftUI-based Destination to be presented.
columnThe column to present this Destination in.
shouldUpdateSelectedColumnDetermines 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
destinationIDA 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<DestinationType, ContentType, TabType>)?Parameters
columnThe 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
Viewin a column, but is instead theViewwhich is at the column’s root level, such as aNavigationStack.This method should be used when building the column for a
NavigationSplitView.Default Implementation
Declaration
Swift
@MainActor func rootDestination(for column: NavigationSplitViewColumn) -> (any ViewDestinationable<DestinationType, ContentType, TabType>)?Parameters
columnThe column type.
Return Value
A Destination, if one was found.
-
updateChildren()Extension methodDeclaration
Swift
@MainActor func updateChildren() -
replaceChild(currentID:Extension methodwith: removeDestinationFromFlowClosure: ) Declaration
Swift
@MainActor func replaceChild(currentID: UUID, with newDestination: any Destinationable<DestinationType, ContentType, TabType>, removeDestinationFromFlowClosure: RemoveDestinationFromFlowClosure? = nil)
View on GitHub