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.
-
Type of
UIViewController
thatContainerFactory
can buildDeclaration
Swift
associatedtype ViewController
-
Context
to be passed intoUIViewController
Declaration
Swift
associatedtype Context
-
Builds a
UIViewController
that will be integrated into the stackParameters:
- context: A
Context
instance that is provided to theRouter
. - coordinator: A
ChildCoordinator
instance.Throws
TheRoutingError
if build did not succeed.
Declaration
Swift
func build(with context: Context, integrating coordinator: ChildCoordinator) throws -> ViewController
Return Value
The built
UIViewController
instance with the children view controller inside. - context: A
-
prepare(with:
Extension method) Default implementation does nothing
Declaration
Swift
mutating func prepare(with context: Context) throws
-
build(with:
Extension method) Builds a
ContainerFactory
view controller.Declaration
Swift
func build(with context: Context) throws -> ViewController
-
execute(with:
Extension method) Prepares the
Factory
and builds itsUIViewController
Declaration
Swift
func execute(with context: Context) throws -> ViewController
-
build()
Extension methodBuilds a
ContainerFactory
view controller.Declaration
Swift
func build() throws -> ViewController
-
execute()
Extension methodPrepares the
Factory
and builds itsUIViewController
Declaration
Swift
func execute() throws -> ViewController
-
build()
Extension methodBuilds a
ContainerFactory
view controller.Declaration
Swift
func build() throws -> ViewController
-
execute()
Extension methodPrepares the
Factory
and builds itsUIViewController
Declaration
Swift
func execute() throws -> ViewController