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 theNavigationSplitViewColumn
column type should be displayed in.Declaration
Swift
@MainActor var destinationIDsForColumns: [NavigationSplitViewColumn : UUID] { get set }
-
A reference to the
View
currently used in thesidebar
column of this Destination’s associatedNavigationSplitView
. This property is updated when a newView
is presented in the column.To implement this in your
View
and enable dynamic updating of yourNavigationSplitView
‘s column, bind this property from inside thesidebar
column’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
View
currently used in thecontent
column of this Destination’s associatedNavigationSplitView
. This property is updated when a newView
is presented in the column.To implement this in your
View
and enable dynamic updating of yourNavigationSplitView
‘s column, bind this property from inside thecontent
column’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
View
currently used in thedetail
column of this Destination’s associatedNavigationSplitView
. This property is updated when a newView
is presented in the column.To implement this in your
View
and enable dynamic updating of yourNavigationSplitView
‘s column, bind this property from inside thedetail
column’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
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 theView
which 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<PresentationConfiguration>)?
Parameters
column
The 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<PresentationConfiguration>, removeDestinationFromFlowClosure: RemoveDestinationFromFlowClosure? = nil)