DestinationPresentation

@MainActor
public final class DestinationPresentation<DestinationType, ContentType, TabType> : DestinationPresentationConfiguring where DestinationType : RoutableDestinations, ContentType : ContentTypeable, TabType : TabTypeable
extension DestinationPresentation: Hashable, Equatable

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 InterfaceAction and used to trigger a new presentation when a user interaction is made with the current UI.

Destinations has several built-in presentation types which DestinationPresentation supports to enable native SwiftUI and UIKit UI navigation, as well as more complex or custom behavior.

  • navigationController(type: NavigationPresentationType) This presentation type will add and present a Destination in a navigation stack such as a UINavigationController or SwiftUI’s NavigationStack.
  • tabBar(tab: TabType) This presentation type will present a Destination in the specified tab of a tab bar component, such as a UITabBarController or SwiftUI’s TabView. If no destinationType is present in the DestinationPresentation model, 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 a UISplitViewController or SwiftUI’s NavigationSplitView.
  • addToCurrent This presentation type adds a Destination as a child of the currently-presented Destination. Note that this type only works with UIKit and utilizes UIViewController‘s addChild method.
  • replaceCurrent This 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. The options parameter allows you to customize how the sheet is presented, configuring SwiftUI-specific options with a ViewSheetPresentationOptions model and UIKit-specific options with a ControllerSheetPresentationOptions model.
  • 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 user interaction.
  • 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. The presentation parameter allows you to use a CustomPresentation model with specialized closures to provide whatever functionality you need.