Router

open class Router

Object responsible for performing navigation to concrete routes, as well as keeping references to root view provider and view finder.

  • Object responsible for finding view on which route should be performed.

    Declaration

    Swift

    open var viewFinder: ViewFinder
  • Object responsible for providing root view of interface hierarchy.

    Declaration

    Swift

    open var rootViewProvider: RootViewProvider
  • Creates Router with CurrentlyVisibleViewFinder object set as a ViewFinder instance.

    Declaration

    Swift

    public init(rootViewProvider: RootViewProvider)

    Parameters

    rootViewProvider

    provider of the root view of interface.

  • Creates Router with specified root view provider and view finder.

  • Returns route, that calls popViewController method on currently visible navigation controller. No view is getting built in the process of routing.

    Declaration

    Swift

    open class func popRoute(isAnimated: Bool = true) -> Route<NonBuilder, PopNavigationTransition>

    Parameters

    isAnimated

    should the transition be animated.

    Return Value

    performable route.

  • Returns route, that calls popViewController method on currently visible navigation controller. No view is getting built in the process of routing.

    Declaration

    Swift

    open func popRoute(isAnimated: Bool = true) -> Route<NonBuilder, PopNavigationTransition>

    Parameters

    isAnimated

    should the transition be animated.

    Return Value

    performable route.

  • Returns route, that calls popToRootViewController method on currently visible navigation controller. No view is getting built in the process of routing.

    Declaration

    Swift

    open class func popToRootRoute(isAnimated: Bool = true) -> Route<NonBuilder, PopNavigationTransition>

    Parameters

    isAnimated

    should the transition be animated.

    Return Value

    performable route.

  • Returns route, that calls popToViewController(_:animated:) method on currently visible navigation controller. No view is getting built in the process of routing. First instance of type view controllers available in navigation stack is selected

    Declaration

    Swift

    open class func popToFirstInstanceOf(_ type: UIViewController.Type, isAnimated: Bool = true) -> Route<NonBuilder, PopNavigationTransition>

    Parameters

    type

    type of view controller to search for in navigation stack

    isAnimated

    should the transition be animated.

  • Returns route, that calls popToViewController(_:animated:) method on currently visible navigation controller. No view is getting built in the process of routing. First instance of type view controllers available in navigation stack is selected

    Declaration

    Swift

    open func popToFirstInstanceOf(_ type: UIViewController.Type, isAnimated: Bool = true) -> Route<NonBuilder, PopNavigationTransition>

    Parameters

    type

    type of view controller to search for in navigation stack

    isAnimated

    should the transition be animated.

  • Returns route, that calls popToViewController(_:animated:) method on currently visible navigation controller. No view is getting built in the process of routing. Last instance of type view controllers available in navigation stack is selected.

    Declaration

    Swift

    open class func popToLastInstanceOf(_ type: UIViewController.Type, isAnimated: Bool = true) -> Route<NonBuilder, PopNavigationTransition>

    Parameters

    type

    type of view controller to search for in navigation stack

    isAnimated

    should the transition be animated.

  • Returns route, that calls popToViewController(_:animated:) method on currently visible navigation controller. No view is getting built in the process of routing. Last instance of type view controllers available in navigation stack is selected.

    Declaration

    Swift

    open func popToLastInstanceOf(_ type: UIViewController.Type, isAnimated: Bool = true) -> Route<NonBuilder, PopNavigationTransition>

    Parameters

    type

    type of view controller to search for in navigation stack

    isAnimated

    should the transition be animated.

  • Returns route, that calls popToRootViewController method on currently visible navigation controller. No view is getting built in the process of routing.

    Declaration

    Swift

    open func popToRootRoute(isAnimated: Bool = true) -> Route<NonBuilder, PopNavigationTransition>

    Parameters

    isAnimated

    should the transition be animated.

    Return Value

    performable route.

  • Returns route, that calls dismiss method on currently visible view controller. No view is getting built in the process of routing.

    Declaration

    Swift

    open class func dismissRoute(isAnimated: Bool = true) -> Route<NonBuilder, DismissTransition>

    Parameters

    isAnimated

    should the transition be animated.

    Return Value

    performable route.

  • Returns route, that calls dismiss method on currently visible view controller. No view is getting built in the process of routing.

    Declaration

    Swift

    open func dismissRoute(isAnimated: Bool = true) -> Route<NonBuilder, DismissTransition>

    Parameters

    isAnimated

    should the transition be animated.

    Return Value

    performable route.

  • Performs navigation to route using provided context and calling completion once routing process is completed.

    Declaration

    Swift

    open func navigate<T: Routable>(to route: T,
                                    with context: T.Builder.Context,
                                    completion: ((Bool) -> Void)? = nil)

    Parameters

    route

    route to navigate to.

    context

    object that will be used to build view to navigate to, if needed.

    completion

    will be called once routing is completed.

  • Performs navigation to route and calls completion once routing process is completed.

    Declaration

    Swift

    open func navigate<T: Routable>(to route: T, completion: ((Bool) -> Void)? = nil)
        where T.Builder.Context == Void

    Parameters

    route

    route to navigate to.

    completion

    will be called once routing is completed.