BasicCoordinator

open class BasicCoordinator<RouteType, TransitionType> : BaseCoordinator<RouteType, TransitionType> where RouteType : Route, TransitionType : TransitionProtocol

BasicCoordinator is a coordinator class that can be used without subclassing.

Although subclassing of coordinators is encouraged for more complex cases, a BasicCoordinator can easily be created by only providing a prepareTransition closure, an initialRoute and an initialLoadingType.

  • InitialLoadingType differentiates between different points in time when the initital route is to be triggered by the coordinator.

    See more

    Declaration

    Swift

    public enum InitialLoadingType
  • Creates a BasicCoordinator.

    Seealso

    See InitialLoadingType for more information.

    Declaration

    Swift

    public init(rootViewController: RootViewController,
                initialRoute: RouteType? = nil,
                initialLoadingType: InitialLoadingType = .presented,
                prepareTransition: ((RouteType) -> TransitionType)?)

    Parameters

    initialRoute

    If a route is specified, it is triggered depending on the initialLoadingType.

    initialLoadingType

    The initialLoadingType specifies when the initialRoute is triggered.

    prepareTransition

    A closure to define transitions based on triggered routes. Make sure to override prepareTransition by subclassing, if you specify nil here.

  • This method is called whenever the BasicCoordinator is shown to the user.

    If initialLoadingType has been specified as presented and an initialRoute is present, the route is triggered here.

    Declaration

    Swift

    open override func presented(from presentable: Presentable?)

    Parameters

    presentable

    The context in which this coordinator has been shown to the user.

  • Declaration

    Swift

    open override func prepareTransition(for route: RouteType) -> TransitionType