AbstractFactory

@MainActor
public protocol AbstractFactory

Base protocol for all types of factories. An instance that extends AbstractFactory builds a UIViewController that will later be integrated into the stack by the Router

Associated types

  • Type of UIViewController that AbstractFactory can build

    Declaration

    Swift

    associatedtype ViewController : UIViewController
  • Context to be passed into UIViewController

    Declaration

    Swift

    associatedtype Context

Methods to implement

  • The Router will call it before the navigation process and if the AbstractFactory is not able to build a view controller it should throw an exception. (example: it has to build a product view controller but there is no product code in context)

    Throws

    The RoutingError if the Factory cannot prepare to build a UIViewController instance with the Context instance provided.

    Declaration

    Swift

    @MainActor
    mutating func prepare(with context: Context) throws

    Parameters

    context

    A Context instance that is provided to the Router.

Available where Context == Any?

  • prepare() Extension method

    Prepares the AbstractFactory

    Declaration

    Swift

    @MainActor
    mutating func prepare() throws

Available where Context == Void

  • prepare() Extension method

    Prepares the AbstractFactory

    Declaration

    Swift

    @MainActor
    mutating func prepare() throws