ViewFlowable
@MainActor
public protocol ViewFlowable<DestinationType, ContentType, TabType> : Flowable where Self.InterfaceCoordinator == DestinationSwiftUICoordinator, Self.PresentationType == DestinationPresentationType<Self.DestinationType, Self.ContentType, Self.TabType>
This protocol represents a Flow which coordinates routing and navigation as a user moves through a SwiftUI-based app.
-
An enum which defines available Destination presentation types. Typically this is
DestinationPresentationType.Declaration
Swift
typealias PresentationType = DestinationPresentationType<DestinationType, ContentType, TabType> -
A dictionary of Destination providers whose keys are an enum of Destination types. The Destination type represents the type of Destination each provider can provide.
Declaration
Swift
@MainActor var destinationProviders: [DestinationType : any ViewDestinationProviding] { get set } -
Provides a Destination based on the provided configuration model.
Declaration
Swift
@MainActor func destination(for configuration: DestinationPresentation<DestinationType, ContentType, TabType>) -> (any ViewDestinationable<DestinationType, ContentType, TabType>)?Parameters
configurationThe presentation configuration model describing the Destination to return.
Return Value
The requested Destination, if one was found or able to be built.
-
buildDestination(for:Default implementation) Builds and returns a new Destination based on the supplied configuration model.
Default Implementation
Declaration
Swift
@MainActor func buildDestination(for configuration: DestinationPresentation<DestinationType, ContentType, TabType>) -> (any ViewDestinationable<DestinationType, ContentType, TabType>)?Parameters
configurationA presentation configuration model to build the Destination.
Return Value
The created Destination, if one could be built.
-
Presents a Destination based on the supplied configuration model.
Declaration
Swift
@discardableResult @MainActor func presentDestination(configuration: DestinationPresentation<DestinationType, ContentType, TabType>) -> (any ViewDestinationable<DestinationType, ContentType, TabType>)?Parameters
configurationA presentation configuration model by which to find or build a Destination.
Return Value
The presented Destination, if one was found or created.
-
updateDestinationConfiguration(configuration:Default implementationdestination: ) Updates a presentation configuration model.
Default Implementation
Declaration
Swift
@MainActor func updateDestinationConfiguration(configuration: inout DestinationPresentation<DestinationType, ContentType, TabType>, destination: inout some ViewDestinationable<DestinationType, ContentType, TabType>)Parameters
configurationA presentation configuration model to update.
destinationA Destination to update.
-
findNavigatorInViewHierarchy(searchDestination:Default implementation) Finds the closest navigator in the view hierarchy to the provided Destination.
Default Implementation
Declaration
Swift
@MainActor func findNavigatorInViewHierarchy(searchDestination: any ViewDestinationable) -> (any DestinationPathNavigating)?Parameters
currentDestinationThe Destination to start searching at.
Return Value
Returns a navigator, if one was found.
-
findSplitViewInViewHierarchy(currentDestination:Default implementation) Finds the closest Destination in the view hierarchy whose interface is a
NavigationSplitView.Default Implementation
Declaration
Swift
@MainActor func findSplitViewInViewHierarchy(currentDestination: any ViewDestinationable) -> (any NavigationSplitViewDestinationable<DestinationType, ContentType, TabType>)?Parameters
currentDestinationThe Destination to start searching at.
Return Value
Returns a Destination, if one was found.
-
findTabBarInViewHierarchy(searchDestination:Default implementation) Finds the closest Destination in the view hierarchy whose interface manages a
TabBar.Default Implementation
Declaration
Swift
@MainActor func findTabBarInViewHierarchy(searchDestination: any ViewDestinationable) -> (any TabBarViewDestinationable<DestinationType, ContentType, TabType>)?Parameters
currentDestinationThe Destination to start searching at.
Return Value
Returns a
TabBarDestination, if found. -
defaultTabBarPresentationClosure()Default implementationThe default presentation closure run when a Destination is presented in the tab of a
TabView.Default Implementation
Declaration
Swift
@MainActor func defaultTabBarPresentationClosure() -> ((_ destination: any ViewDestinationable<DestinationType, ContentType, TabType>, _ tabViewID: UUID) -> Void)Return Value
A closure.
-
presentNextDestinationInQueue(contentToPass:Extension method) Declaration
Swift
@discardableResult @MainActor func presentNextDestinationInQueue(contentToPass: ContentType? = nil) -> (any Destinationable<DestinationType, ContentType, TabType>)? -
presentDestinationPath(path:Extension methodcontentToPass: ) Declaration
Swift
@MainActor func presentDestinationPath(path: [DestinationPresentation<DestinationType, ContentType, TabType>], contentToPass: ContentType? = nil) -
defaultCompletionClosure(configuration:Extension methoddestination: ) Declaration
Swift
@MainActor func defaultCompletionClosure(configuration: DestinationPresentation<DestinationType, ContentType, TabType>, destination: (any Destinationable<DestinationType, ContentType, TabType>)? = nil) -> PresentationCompletionClosure? -
defaultSheetDismissalCompletionClosure(configuration:Extension method) Declaration
Swift
@MainActor func defaultSheetDismissalCompletionClosure(configuration: DestinationPresentation<DestinationType, ContentType, TabType>) -> PresentationCompletionClosure? -
defaultNavigationBackCompletionClosure(configuration:Extension method) Declaration
Swift
@MainActor func defaultNavigationBackCompletionClosure(configuration: DestinationPresentation<DestinationType, ContentType, TabType>) -> PresentationCompletionClosure? -
destinationView(for:Extension method) A
ViewBuildermethod that returns a strongly-typedViewassociated with the specified Destiantion.Declaration
Swift
@ViewBuilder @MainActor func destinationView(for destinationID: UUID) -> (some View)?Parameters
destinationIDThe identifier of the Destination.
Return Value
A strongly-typed
Viewassociated with the specified Destination. -
startingDestinationView()Extension methodA
ViewBuilderthat returns a strongly-typedViewassociated with the Flow’s starting Destination.Declaration
Swift
@ViewBuilder @MainActor func startingDestinationView() -> (some View)?Return Value
A strongly-typed
Viewassociated with the Flow’s starting Destination.
View on GitHub