Router

public protocol Router

Base router protocol.

Methods to implement

  • Navigates the application to the view controller configured in DestinationStep with the Context provided.

    Declaration

    Swift

    func navigate<ViewController: UIViewController, Context>(to step: DestinationStep<ViewController, Context>,
                                                             with context: Context,
                                                             animated: Bool,
                                                             completion: ((_: RoutingResult) -> Void)?) throws

    Parameters

    step

    DestinationStep instance.

    context

    Context instance.

    animated

    if true - the navigation should be animated where it is possible.

    completion

    completion block.

Navigation methods for the Destination instance

  • Navigates the application to the view controller configured in Destination with the Context provided.

    Declaration

    Swift

    func navigate(to destination: Destination<some UIViewController, some Any>, animated: Bool = true, completion: ((RoutingResult) -> Void)? = nil) throws

    Parameters

    destination

    Destination instance.

    animated

    if true - the navigation should be animated where it is possible.

    completion

    completion block.

  • Navigates the application to the view controller configured in Destination with the Context provided. Method does not throw errors, but propagates them to the completion block.

    Declaration

    Swift

    func commitNavigation(to destination: Destination<some UIViewController, some Any>, animated: Bool = true, completion: ((RoutingResult) -> Void)? = nil)

    Parameters

    destination

    Destination instance.

    animated

    if true - the navigation should be animated where it is possible.

    completion

    completion block.

Helper methods

  • Navigates the application to the view controller configured in DestinationStep with the Context set to Any?.

    Declaration

    Swift

    func navigate(to step: DestinationStep<some UIViewController, Any?>,
                  animated: Bool,
                  completion: ((_: RoutingResult) -> Void)?) throws

    Parameters

    step

    DestinationStep instance.

    animated

    if true - the navigation should be animated where it is possible.

    completion

    completion block.

  • Navigates the application to the view controller configured in DestinationStep with the Context set to Void.

    Declaration

    Swift

    func navigate(to step: DestinationStep<some UIViewController, Void>,
                  animated: Bool,
                  completion: ((_: RoutingResult) -> Void)?) throws

    Parameters

    step

    DestinationStep instance.

    animated

    if true - the navigation should be animated where it is possible.

    completion

    completion block.

Navigation without the exception throwing

  • Navigates the application to the view controller configured in DestinationStep with the Context provided. Method does not throw errors, but propagates them to the completion block

    Declaration

    Swift

    func commitNavigation<Context>(to step: DestinationStep<some UIViewController, Context>,
                                   with context: Context,
                                   animated: Bool,
                                   completion: ((RoutingResult) -> Void)?)

    Parameters

    step

    DestinationStep instance.

    context

    Context instance.

    animated

    if true - the navigation should be animated where it is possible.

    completion

    completion block.

  • Navigates the application to the view controller configured in DestinationStep with the Context set to Any?. Method does not throw errors, but propagates them to the completion block

    Declaration

    Swift

    func commitNavigation(to step: DestinationStep<some UIViewController, Any?>,
                          animated: Bool,
                          completion: ((RoutingResult) -> Void)?)

    Parameters

    step

    DestinationStep instance.

    animated

    if true - the navigation should be animated where it is possible.

    completion

    completion block.

  • Navigates the application to the view controller configured in DestinationStep with the Context set to Void. Method does not throw errors, but propagates them to the completion block

    Declaration

    Swift

    func commitNavigation(to step: DestinationStep<some UIViewController, Void>,
                          animated: Bool,
                          completion: ((RoutingResult) -> Void)?)

    Parameters

    step

    DestinationStep instance.

    animated

    if true - the navigation should be animated where it is possible.

    completion

    completion block.