ContainerFactory
@MainActor
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.
-
Type of
UIViewControllerthatContainerFactorycan buildDeclaration
Swift
associatedtype ViewController -
Contextto be passed intoUIViewControllerDeclaration
Swift
associatedtype Context
-
Builds a
UIViewControllerthat will be integrated into the stackParameters:
- context: A
Contextinstance that is provided to theRouter. - coordinator: A
ChildCoordinatorinstance.Throws
TheRoutingErrorif build did not succeed.
Declaration
Swift
@MainActor func build(with context: Context, integrating coordinator: ChildCoordinator) throws -> ViewControllerReturn Value
The built
UIViewControllerinstance with the children view controller inside. - context: A
-
prepare(with:Extension method) Default implementation does nothing
Declaration
Swift
@MainActor mutating func prepare(with context: Context) throws
-
build(with:Extension method) Builds a
ContainerFactoryview controller.Declaration
Swift
@MainActor func build(with context: Context) throws -> ViewController -
execute(with:Extension method) Prepares the
Factoryand builds itsUIViewControllerDeclaration
Swift
@MainActor func execute(with context: Context) throws -> ViewController
-
build()Extension methodBuilds a
ContainerFactoryview controller.Declaration
Swift
@MainActor func build() throws -> ViewController -
execute()Extension methodPrepares the
Factoryand builds itsUIViewControllerDeclaration
Swift
@MainActor func execute() throws -> ViewController
-
build()Extension methodBuilds a
ContainerFactoryview controller.Declaration
Swift
@MainActor func build() throws -> ViewController -
execute()Extension methodPrepares the
Factoryand builds itsUIViewControllerDeclaration
Swift
@MainActor func execute() throws -> ViewController