ContainerFactory

public protocol ContainerFactory : AbstractFactory where Self.ViewController : ContainerViewController

The ContainerFactory protocol should be implemented by the instance that produces any types of the view controllers that can be considered as containers (eg: UINavigationController, UITabBarController, etc)

The Router uses ContainerAction.perform(...) method of a ContainerAction and then populates a full stack of the view controllers that were built by the associated factories in one go. Example: Router requires to populate N-view controllers into UINavigationController‘s stack.

Associated types

  • Type of UIViewController that ContainerFactory can build

    Declaration

    Swift

    associatedtype ViewController
  • Context to be passed into UIViewController

    Declaration

    Swift

    associatedtype Context

Methods to implement

Default implementation

  • prepare(with:) Extension method

    Default implementation does nothing

    Declaration

    Swift

    mutating func prepare(with context: Context) throws

Helper methods

Available where Context == Any?

  • build() Extension method

    Builds a ContainerFactory view controller.

    Declaration

    Swift

    func build() throws -> ViewController
  • execute() Extension method

    Prepares the Factory and builds its UIViewController

    Declaration

    Swift

    func execute() throws -> ViewController

Available where Context == Void

  • build() Extension method

    Builds a ContainerFactory view controller.

    Declaration

    Swift

    func build() throws -> ViewController
  • execute() Extension method

    Prepares the Factory and builds its UIViewController

    Declaration

    Swift

    func execute() throws -> ViewController