Classes
The following classes are available globally.
-
This object represents a single action in an
ActionPerformableCollectionobject. The actual work done is handled by an Interactor; this object callsasyncRequestForAction(destination:actionType:content:resultTransformer:)on its assistant, and upon completion adds its result to a results array it passes along to this step’s output conduit. If there is no conduit attached, it will assume the sequence is completed and return all results. If the action’s task is cancelled ancancelled(partialResults:)error will be returned; if the interactor returns a failure anActionError/failed(partialResults:)error will be returned, both with the accumulated results that completed previously in the sequence.See moreNote
Generally you should not create this object directly. Instead,
ActionConfigurationobjects should be used to represent sequence steps in conjunction with anActionSequenceConfigurationobject.Declaration
Swift
@MainActor public final class Action<InteractorType, ContentType> : ActionPerformable where InteractorType : InteractorTypeable, ContentType : ContentTypeable -
An
ActionPerformableconforming type which selects and runs one of several actions based on provided conditions, evaluated against the current content and previous results in a sequence and runs the first path whose conditions returntrue. Branches are mainly only used as a step in anActionSequence.ActionBranchevaluates itsBranchConditionableconditions in declaration order and runs the first path whose condition (or conditions, if a group condition likeAllSatisfyConditionorAnySatisfyConditionis used) returnstrue. If no condition matches and there’s no fallback action, the branch fails withcancelled(partialResults:). To guarantee a fallback path, you can add on an.otherwisepath at the end of the branch chain. After the selected path action completes,ActionBranchapplies the path’s optional transformer to the result and forwards the content through its own output conduit to the next sequence step, recording oneActionResultwith originbranch.In the example below, if there are images passed-in from the previous step, it will process the images with a filter. If instead the content is text, it will render the text into an image. If neither was provided, it will choose the fallback action. This branch object could then be used as a sequence step or in a group of actions.
let branch = ActionBranchConfiguration<AppInteractorType, AppContentType>() .branch(when: HasImagesCondition(), action: processImageStep) .branch(when: HasTextCondition(), action: renderTextStep) .otherwise(fallbackAction)See moreNote
Do not instantiate this type directly. Use
ActionBranchConfigurationto define and build a branch step.Declaration
Swift
@MainActor public final class ActionBranch<ContentType> : ActionPerformable where ContentType : ContentTypeable -
A group of actions which run concurrently, merging their results into one content value.
The child requests all run concurrently and receive the same input content. When they complete, a
ActionResultsMergingobject merges their results into a single content value. The group passes this content value and all of the group’s child results via a singleActionResult, and passes the merged value on through its output conduit.Child failure behavior
Each child’s
shouldEndParentTaskOnFailureflag controls what happens when that child fails:true: The group immediately callscancelAll()on its remaining siblings, builds a group-levelActionResultcontaining all results collected up to that point plus the failing child’s failure result, and returnscancelled(partialResults:). Siblings that had not yet completed are cancelled.false: The group records the failure and lets all remaining siblings run to completion. Once every child has finished, the group builds a single group-levelActionResultwhoseoriginproperty includes child results for every task’s success or failure in declaration order, then returnscancelled(partialResults:). The merger is not called because not all children succeeded.
In both cases the caller receives one group
ActionResultwith agroup(results:)origin. UsefailedActions()on the partial results to inspect which children failed.Note
You should not instantiate an
ActionGroupdirectly. Instead you should create anActionGroupConfigurationobject to define it, and used in conjunction withperformActions(configuration:content:).Usage
Build a group by composing child
ActionConfigurationobjects inside anActionGroupConfiguration. You can either assign this configuration tointeractorsDataand run it via its associated event type, or you can build these configurations within a state model and callperformActions(configuration:content:)on its Destination.
See more// Each child configuration represents one parallel Interactor request. let retrievalChildren: [any ActionConfiguring<InteractorType, ContentType>] = [ ActionConfiguration<InteractorType, ContentType, MyInteractor>( interactorType: .myType, action: .retrieveFile, assistant: .basicAsync, identifier: ActionIdentifier.retrieve), ActionConfiguration<InteractorType, ContentType, MyInteractor>( interactorType: .myType, action: .retrieveFile, assistant: .basicAsync, identifier: ActionIdentifier.retrieve) ] // The merger combines each child's result into a single ContentType value. let retrievals = ActionGroupConfiguration<InteractorType, ContentType>( actions: retrievalChildren, merger: FileMerger(), identifier: ActionIdentifier.retrievalGroup) let result = await destination.performActions(configuration: retrievals, content: nil) if case .success(let outputs) = result, let groupResult = outputs.last(identifier: ActionIdentifier.retrievalGroup) { // groupResult.content holds the merged value from all parallel children. }Declaration
Swift
@MainActor public final class ActionGroup<ContentType> : ActionPerformableCollection where ContentType : ContentTypeable -
This object controls a sequence of actions that are run in serial order, passing output from one sequence step to the next.
ActionSequencemanages a chain ofActionPerformablesteps connected by output conduits. Each step receives the content produced by the previous step via its output conduit. The sequence is run starting from the first action, which signals each action to run successively in order. A sequence step can also be anActionGroup, which runs a collection of actions in parallel.Note
Generally you should not instantiate an ActionSequence directly. Instead you should use an
ActionSequenceConfigurationobject to build it. You can either assign this configuration to DestinationProviding/interactorsData and run it via its associated event type, or you can build these configurations within a state model and call Destinationable/performActions(configuration:content:)-c2a7 on its Destination.Usage
Build a sequence by composing
ActionConfigurationsteps inside anActionSequenceConfigurationusing the.step(_:inputTransformer:)builder API. Each call to.step(_:)automatically links the previous step’s output to the new step; the optionalinputTransformerconverts that output before the new step receives it.
See more// Step 1: retrieve data from an interactor. let retrievalStep = ActionConfiguration<InteractorType, ContentType, FetchInteractor>( interactorType: .api, action: .retrieve, assistant: .basicAsync, identifier: ActionIdentifier.retrieve) // Step 2: process the retrieved data. let processStep = ActionConfiguration<InteractorType, ContentType, ProcessInteractor>( interactorType: .process, action: .transform, assistant: .basicAsync, identifier: ActionIdentifier.process) // Link the steps: retrievalStep's output is transformed and passed into processStep. let filesSequence = ActionSequenceConfiguration<InteractorType, ContentType>(identifier: ActionIdentifier.fileSequence) .step(retrievalStep) .step(processStep, inputTransformer: FileTransformer()) // Run the actions and inspect the accumulated results. let result = await destination.performActions(configuration: filesSequence, content: nil) if case .success(let outputs) = result, let processResult = outputs.last(identifier: ActionIdentifier.fileSequence), case .savedFiles(let urls) = processResult.content { // processResult.content holds the final transformed value. }Declaration
Swift
@MainActor public final class ActionSequence<ContentType> : ActionPerformableCollection where ContentType : ContentTypeable -
A container class for Destination presentation configuration models, which are used by a Destination to present new Destinations.
See moreDeclaration
Swift
public final class AppDestinationConfigurations<EventType, DestinationType, ContentType, TabType> : DestinationConfigurationsContaining where EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable -
Undocumented
See moreDeclaration
Swift
@MainActor public final class DefaultDestinationState<Destination> : StateModeling where Destination : Destinationable -
A default assistant to be used to configure the presentation of Destination routes. This only adds the the current Destination’s
See moreidas theparentIDvalue.Declaration
Swift
@MainActor public final class DefaultPresentationAssistant<EventType, DestinationType, ContentType> : InterfaceActionConfiguring where EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable -
Manages state for a Destination’s interface and holds a reference to it.
See moreDeclaration
Swift
@MainActor public final class DestinationInterfaceState<Destination> : DestinationStateable where Destination : Destinationable -
This class holds the internal state of classes conforming to the
See moreDestinationableprotocol.Declaration
Swift
public final class DestinationInternalState<EventType, DestinationType, ContentType, TabType, InteractorType> : DestinationInternalStateable where EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeable -
This is a model used to configure how a Destination is presented or removed. It contains information such as the type of Destination to present, the type of presentation to be made, and the type of content to pass along. They are typically associated with a particular
InterfaceActionand used to trigger a new presentation when a user interaction is made with the current UI.Destinations has several built-in presentation types which
DestinationPresentationsupports to enable native SwiftUI and UIKit UI navigation, as well as more complex or custom behavior.navigationStack(type: NavigationPresentationType)This presentation type will add and present a Destination in a navigation stack such as aUINavigationControlleror SwiftUI’sNavigationStack.tabBar(tab: TabType)This presentation type will present a Destination in the specified tab of a tab bar component, such as aUITabBarControlleror SwiftUI’sTabView. If nodestinationTypeis present in theDestinationPresentationmodel, the specified tab will simply be selected, becoming the active tab within the interface.splitView(column: SplitViewColumn)This presentation type will present a Destination in a column of a split view interface, such as aUISplitViewControlleror SwiftUI’sNavigationSplitView.addToCurrentThis presentation type adds a Destination as a child of the currently-presented Destination. Note that this type only works with UIKit and utilizesUIViewController‘saddChildmethod.replaceRootThis presentation type removes all Destinations that are currently presented and adds a new root Destination. This is useful in use cases such as a user signing out, where you need to remove all the current UI and present a new screen.replaceCurrentThis presentation type replaces the currently-presented Destination with a new Destination in system UI components which allow that.sheet(type: SheetPresentationType, options: SheetPresentationOptions?)This presentation type presents (or dismisses) a Destination in a sheet. Theoptionsparameter allows you to customize how the sheet is presented, configuring SwiftUI-specific options with aViewSheetPresentationOptionsmodel and UIKit-specific options with aControllerSheetPresentationOptionsmodel.destinationPath(path: [DestinationPresentation])This presentation type presents a path of multiple Destination objects, useful for providing deep linking functionality or building complex state with one event. This presentation could be used for instance to rebuild a navigation stack when resuming a user’s state.custom(presentation: CustomPresentation<DestinationPresentation>)This presentation type enables you to present a custom presentation of a Destination. It can be used to support the presentation of custom UI, as well as system components which Destinations does not directly support. Thepresentationparameter allows you to use aCustomPresentationmodel with specialized closures to provide whatever functionality you need.
Declaration
Swift
@MainActor public final class DestinationPresentation<DestinationType, ContentType, TabType> where DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeableextension DestinationPresentation: Hashable, Equatable -
A singleton object which contains global options and an internal logger for Destinations. If you wish to interact with this class, please use the
See moresharedreference.Declaration
Swift
@MainActor public final class DestinationsSupport -
This class holds internal state specific to the
See moreGroupedDestinationableprotocol.Declaration
Swift
public final class GroupDestinationInternalState<DestinationType, ContentType, TabType> : GroupDestinationInternalStateable where DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable -
Manages state for a Destination’s interface, holding a reference to its associated Destination and a navigator object which manages the state of the interface’s navigation stack.
See moreDeclaration
Swift
@MainActor public final class NavigationDestinationInterfaceState<Destination> : NavigationDestinationStateable where Destination : Destinationable -
This class brings SwiftUI’s
See moreNavigationStackinto the Destinations ecosystem, handling the state of the stack.Declaration
Swift
@MainActor public final class DestinationNavigator : DestinationPathNavigating -
This class coordinates the presentation of a Destination within the SwiftUI framework.
See moreDeclaration
Swift
@MainActor public final class DestinationSwiftUICoordinator : NSObject, DestinationSwiftUICoordinating -
A Destination which represents a SwiftUI
Viewthat contains aNavigationSplitView.This is a generic Destination that can be used to represent
NavigationSplitViewimplementations in a SwiftUI-based app.To implement the
NavigationSplitViewassociated with this Destination and to enable dynamic updating of yourNavigationSplitView‘s column, bind these properties from inside each column’s closure using aBindableContainerView.Example:
See moreNavigationSplitView(columnVisibility: $columnVisibility) { BindableContainerView(content: $destinationState.destination.currentSidebar) } content: { BindableContainerView(content: $destinationState.destination.currentContent) } detail: { BindableContainerView(content: $destinationState.destination.currentDetail) }Declaration
Swift
@MainActor public final class NavigationSplitViewDestination<ViewType, EventType, DestinationType, ContentType, TabType, InteractorType> : NavigationSplitViewDestinationable where ViewType : NavigationSplitViewDestinationInterfacing, EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeable -
A Destination class whose associated user interface is a
Viewwhich contains aNavigationStack.This is a generic Destination that can be used to represent most
See moreNavigationStack-basedViews in a SwiftUI-based app.Declaration
Swift
@MainActor public final class NavigationViewDestination<EventType, ViewType, DestinationType, ContentType, TabType, InteractorType> : NavigatingViewDestinationable where EventType : EventTypeable, ViewType : NavigatingDestinationInterfacing, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeable -
Configures the presentation of a SwiftUI sheet.
See moreDeclaration
Swift
public final class SheetPresentation : SheetPresentationConfiguring -
A Destination which represents a SwiftUI
Viewwhich contains aTabView.This is a generic Destination that can be used to represent most
See moreTabViews in a SwiftUI-based app.Declaration
Swift
@MainActor public final class TabViewDestination<ViewType, EventType, DestinationType, ContentType, TabType, InteractorType> : TabBarViewDestinationable where ViewType : TabBarViewDestinationInterfacing, EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeableextension TabViewDestination: @preconcurrency CustomStringConvertible -
A Destination class whose associated user interface is a SwiftUI
View.This is a generic Destination that can be used to represent most
See moreViews in a SwiftUI-based app.Declaration
Swift
@MainActor public final class ViewDestination<ViewType, EventType, DestinationType, ContentType, TabType, InteractorType> : ViewDestinationable where ViewType : ViewDestinationInterfacing, EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeableextension ViewDestination: Equatableextension ViewDestination: @preconcurrency CustomStringConvertible -
A concrete Flow class designed to be used to manage Destinations flows within the SwiftUI framework. In most cases creating a custom Flow object is unnecessary, and this class can be used as-is in your SwiftUI-based app.
See moreDeclaration
Swift
@MainActor public final class ViewFlow<DestinationType, TabType, ContentType> : ViewFlowable, ObservableObject where DestinationType : RoutableDestinations, TabType : TabTypeable, ContentType : ContentTypeableextension ViewFlow: DestinationInterfaceCoordinatorDelegate -
A model that’s used internally to represent tab types in Destinations.
See moreDeclaration
Swift
public final class TabModel<TabType> : Equatable, Hashable where TabType : TabTypeableextension TabModel: CustomDebugStringConvertible -
A Destination class whose associated user interface is a
UIViewController.This is a generic Destination that can be used to represent most
See moreUIViewControllersubclasses in a UIKit-based app.Declaration
Swift
@MainActor public final class ControllerDestination<ControllerDestinationType, EventType, DestinationType, ContentType, TabType, InteractorType> : ControllerDestinationable where ControllerDestinationType : ControllerDestinationInterfacing, EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeableextension ControllerDestination: Equatableextension ControllerDestination: @preconcurrency CustomStringConvertible -
A concrete Flow class designed to be used to manage Destinations flows within the UIKit framework. In most cases creating a custom Flow object is unnecessary, and this class can be used as-is in your UIKit-based app.
See moreDeclaration
Swift
@MainActor public final class ControllerFlow<DestinationType, TabType, ContentType> : NSObject, ControllerFlowable, UITabBarControllerDelegate where DestinationType : RoutableDestinations, TabType : TabTypeable, ContentType : ContentTypeableextension ControllerFlow: DestinationInterfaceCoordinatorDelegate -
This class coordinates the presentation of a Destination within the UIKit framework.
See moreDeclaration
Swift
@MainActor public final class DestinationUIKitCoordinator : NSObject, DestinationUIKitCoordinating -
A Destination class whose associated user interface is a
UINavigationController.This is a generic Destination that can be used to represent most
See moreUINavigationControllerclasses in a UIKit-based app.Declaration
Swift
@MainActor public final class NavigationControllerDestination<ControllerDestinationType, EventType, DestinationType, ContentType, TabType, InteractorType> : NavigatingControllerDestinationable where ControllerDestinationType : NavigationControllerDestinationInterfacing, EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeableextension NavigationControllerDestination: Equatableextension NavigationControllerDestination: @preconcurrency CustomStringConvertible -
Undocumented
See moreDeclaration
Swift
@MainActor public final class DefaultNavigationController<EventType, DestinationType, ContentType, TabType, InteractorType> : UINavigationController, NavigationControllerDestinationInterfacing where EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeable -
Undocumented
See moreDeclaration
Swift
@MainActor public final class DefaultNavigationControllerDestination<EventType, DestinationType, ContentType, TabType, InteractorType> : NavigatingControllerDestinationable where EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeable -
A
See moreUISplitViewControllersubclass which can be used as an interface for aSplitViewControllerDestination.Declaration
Swift
@MainActor public final class SplitViewController<EventType, DestinationType, ContentType, TabType, InteractorType> : UISplitViewController, SplitViewControllerDestinationInterfacing where EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeable -
A Destination which represents a UIKit
UISplitViewController.This is a generic Destination that can be used to represent most
See moreUISplitViewControllers in a UIKit-based app.Declaration
Swift
@MainActor public final class SplitViewControllerDestination<EventType, DestinationType, ContentType, TabType, InteractorType> : SplitViewControllerDestinationable where EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeable -
Adapts a SwiftUI
See moreViewfor use inside aUIViewController, using aUIHostingControllerto present it within UIKit.Declaration
Swift
@MainActor public final class SwiftUIAdapter<Content> : SwiftUIAdaptable where Content : ViewDestinationInterfacing -
A controller that serves as a container for a SwiftUI
See moreView.Declaration
Swift
@MainActor public final class SwiftUIContainerController<Content> : UIViewController, SwiftUIContainerInterfacing where Content : SwiftUIHostedInterfacing -
A Destination representing a
See moreSwiftUIContainerControllerinstance which presents a SwiftUIViewwithin UIKit.Declaration
Swift
@MainActor public final class SwiftUIContainerDestination<ViewType, EventType, DestinationType, ContentType, TabType, InteractorType> : SwiftUIContainerDestinationable where ViewType : SwiftUIHostedInterfacing, EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeable -
A state object for a SwiftUI
See moreViewbeing hosted within a UIKit interface.Declaration
Swift
@MainActor public final class SwiftUIHostingState<Content, EventType, DestinationType, ContentType, TabType, InteractorType> : NavigationDestinationStateable where Content : SwiftUIHostedInterfacing, EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeable -
A Destination which represents a UIKit
UITabViewController.This is a generic Destination that can be used to represent most
See moreUITabViewControllers in a UIKit-based app.Declaration
Swift
@MainActor public final class TabBarControllerDestination<ControllerType, EventType, DestinationType, ContentType, TabType, InteractorType> : TabBarControllerDestinationable where ControllerType : TabBarControllerDestinationInterfacing, EventType : EventTypeable, DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable, InteractorType : InteractorTypeable
View on GitHub
Classes Reference