TabBarControllerDestinationable

@MainActor
public protocol TabBarControllerDestinationable<DestinationType, ContentType, TabType> : GroupedControllerDestinationable

This protocol represents a Destination whose interface is a UITabBarController.

  • A dictionary of Destination identifiers whose keys are their associated tab types.

    Declaration

    Swift

    @MainActor
    var destinationIDsForTabs: [TabType : UUID] { get set }
  • A representation of the tab types that are currently active.

    Declaration

    Swift

    @MainActor
    var activeTabs: [TabModel<TabType>] { get set }
  • The currently selected tab type.

    Declaration

    Swift

    @MainActor
    var selectedTab: TabModel<TabType> { get set }
  • Update the currently selected tab.

    Declaration

    Swift

    @MainActor
    func updateSelectedTab(type: TabType) throws

    Parameters

    tab

    The tab type to select.

  • currentDestination(for:) Default implementation

    Returns the current Destination for the specified tab.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func currentDestination(for tab: TabType) -> (any ControllerDestinationable<DestinationType, ContentType, TabType>)?

    Parameters

    tab

    The tab type.

    Return Value

    A View-based Destination, if one was found.

  • rootDestination(for:) Default implementation

    Returns the root Destination for the tab. This is not necessarily the Destination representing the currently visible UIViewController in a tab, but is instead the UIViewController which is at the root level of the column, such as a UINavigationController.

    This method should be used when building the tabs for a UITabViewController.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func rootDestination(for tab: TabType) -> (any ControllerDestinationable<DestinationType, ContentType, TabType>)?

    Parameters

    tab

    A tab type.

    Return Value

    A Destination, if one was found.

  • A closure to be run when the selectedTab property changed.

    Declaration

    Swift

    @MainActor
    var selectedTabUpdatedClosure: TabBarControllerSelectedTabUpdatedClosure<TabType>? { get set }
  • Presents a Destination in a tab.

    Note

    This method will throw an error if the requested tab is not found.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func presentDestination(destination: any ControllerDestinationable<DestinationType, ContentType, TabType>, in tab: TabType, shouldUpdateSelectedTab: Bool, presentationOptions: NavigationStackPresentationOptions?, removeDestinationFromFlowClosure: RemoveDestinationFromFlowClosure?) throws

    Parameters

    destination

    A UIKit-based Destination to be presented.

    tab

    The tab type to present this Destination in.

    shouldUpdateSelectedTab

    Determines whether the selected tab should be updated.

    presentationOptions

    A model which provides options for presenting this Destination in the UINavigationController within the tab, including determining whether the presentation should be animated.

  • tab(destinationID:) Default implementation

    Returns a tab based on its associated Destination identifier.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func tab(destinationID: UUID) -> TabType?

    Parameters

    destinationID

    The Destination identifier.

    Return Value

    A tab type, if one was found.

  • tab(for:) Default implementation

    Returns a tab model for its associated type.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func tab(for type: TabType) -> TabModel<TabType>?

    Parameters

    type

    The type of tab.

    Return Value

    A tab model, if one was found in the activeTabs array.

  • tab(containing:) Default implementation

    Returns the tab which contains the specified UIViewController.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func tab(containing controllerToMatch: UIViewController) -> TabType?

    Parameters

    controllerToMatch

    A controller to find.

    Return Value

    A tab type, if one was found.

  • tabIndex(for:) Default implementation

    Returns the index of the specified tab in the activeTabs array.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func tabIndex(for type: TabType) -> Int?

    Parameters

    type

    The tab type.

    Return Value

    An array index, if the tab was found in the array.

  • Assigns the closure to be run when the selected tab changes.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func assignSelectedTabUpdatedClosure(closure: @escaping TabBarControllerSelectedTabUpdatedClosure<TabType>)

    Parameters

    closure

    The closure to run.

  • Updates multiple Destinations in the specified tabs.

    Declaration

    Swift

    @MainActor
    func updateTabControllers(destinations: [any ControllerDestinationable<DestinationType, ContentType, TabType>], for tabs: [TabModel<TabType>])

    Parameters

    destinations

    An array of Destinations

    tabs

    The tabs whose UIViewController stacks should be replaced.

  • Finds a Destination of the specified type within the children of this UITabBarController.

    Default Implementation

    Declaration

    Swift

    @MainActor
    func findDestination(typeToFind: DestinationType, currentLevel: any ControllerDestinationable<DestinationType, ContentType, TabType>) -> (any ControllerDestinationable<DestinationType, ContentType, TabType>)?

    Parameters

    typeToFind

    The type of Destination to find.

    currentLevel

    The current level of the view hierarchy to search at.

    Return Value

    A Destination of the specified type, if one was found.

  • Undocumented

    Declaration

    Swift

    @MainActor
    var supportsIgnoringCurrentDestinationStatus: Bool { get }
  • Declaration

    Swift

    @MainActor
    func addChild(childDestination: any Destinationable<DestinationType, ContentType, TabType>, shouldSetDestinationAsCurrent: Bool? = true, shouldAnimate: Bool? = true)
  • Declaration

    Swift

    @MainActor
    func replaceChild(currentID: UUID, with newDestination: any Destinationable<DestinationType, ContentType, TabType>, removeDestinationFromFlowClosure: RemoveDestinationFromFlowClosure? = nil)
  • updateChildren() Extension method

    Declaration

    Swift

    @MainActor
    func updateChildren()