ContextTask

public protocol ContextTask

The task to be applied after a UIViewController was created or found.

NB

The ContextTask will be applied to the new UIViewController before it’s integration into the stack.

Associated types

  • AUIViewController type associated with this ContextTask

    Declaration

    Swift

    associatedtype ViewController : UIViewController
  • A Context type associated with this ContextTask

    Declaration

    Swift

    associatedtype Context

Methods to implement

  • prepare(with:) Default implementation

    The Router will call this method before the navigation process. If the ContextTask is not able to be applied to a view controller it should throw an exception.

    Throws

    The RoutingError if ContextTask can’t be applied.

    Default Implementation

    Default implementation does nothing

    Declaration

    Swift

    mutating func prepare(with context: Context) throws

    Parameters

    context

    The Context instance provided to the Router

  • The Router will call this method to run the ContextTask immediately after UIViewController been created or found

    Declaration

    Swift

    func perform(on viewController: ViewController, with context: Context) throws

    Parameters

    viewController

    The UIViewController instance described in the step that ContextTask attached to

    context

    The Context instance that was passed to the Router

Helper methods

Available where Context == Any?

  • prepare() Extension method

    The Router will call this method before the navigation process. If the ContextTask is not able to be applied to a view controller it should throw an exception.

    Throws

    The RoutingError if ContextTask can’t be applied.

    Declaration

    Swift

    mutating func prepare() throws
  • perform(on:) Extension method

    The Router will call this method to run the ContextTask immediately after UIViewController been created or found

    Declaration

    Swift

    func perform(on viewController: ViewController) throws

    Parameters

    viewController

    The UIViewController instance described in the step that ContextTask attached to

  • execute(on:) Extension method

    Prepares the ContextTask and executes it

    Declaration

    Swift

    func execute(on viewController: ViewController) throws

Available where Context == Void

  • prepare() Extension method

    The Router will call this method before the navigation process. If the ContextTask is not able to be applied to a view controller it should throw an exception.

    Throws

    The RoutingError if ContextTask can’t be applied.

    Declaration

    Swift

    mutating func prepare() throws
  • perform(on:) Extension method

    The method that will be called by the Router to run ContextTask immediately after UIViewController been created or found

    Declaration

    Swift

    func perform(on viewController: ViewController) throws

    Parameters

    viewController

    The UIViewController instance described in the step that ContextTask attached to

  • execute(on:) Extension method

    Prepares the ContextTask and executes it

    Declaration

    Swift

    func execute(on viewController: ViewController) throws