Routable

public protocol Routable

Type, that is capable of performing route from current screen to another one. One example of such type is Route type, that includes necessary builder to build next visible view, and transition object, that will perform a transition.

  • Type, responsible for building a view, that is needed for routing.

    Declaration

    Swift

    associatedtype Builder : ViewControllerBuilder
  • Type, responsible for performing a transition.

    Declaration

    Swift

    associatedtype Transition : ViewTransition
  • Instance of ViewBuilder.

    Declaration

    Swift

    var builder: Builder { get }
  • Instance of ViewTransition.

    Declaration

    Swift

    var transition: Transition { get }
  • Performs route using provided context.

    Declaration

    Swift

    func perform(withViewFinder: ViewFinder,
                 context: Builder.Context,
                 completion: ((Bool) -> Void)?)

    Parameters

    withViewFinder

    object, that can be used to find currently visible view in view hierarchy

    context

    object, that can be used for building a new route destination view.

    completion

    closure to be called, once routing is completed.

  • chained(with:context:) Extension method

    Chains current route with the next one.

    Declaration

    Swift

    public func chained<T>(with chainedRoute: T, context: T.Builder.Context) -> ChainableRoute<Self, T> where T : Routable

    Parameters

    chainedRoute

    Route to be performed after current one.

    context

    Argument, used to build view for next route.

    Return Value

    ChainedRoute with current Route set as HeadRoute, and chainedRoute set as tailRoute.

  • chained(with:) Extension method

    Chains current route with the next one.

    Declaration

    Swift

    public func chained<T: Routable>(with chainedRoute: T) -> ChainableRoute<Self, T>
        where T.Builder.Context == Void

    Parameters

    chainedRoute

    Route to be performed after current one.

    Return Value

    ChainedRoute with current Route set as HeadRoute, and chainedRoute set as tailRoute.