InlineFactory
@MainActor
public struct InlineFactory<VC, C> : Factory where VC : UIViewController
The Factory that creates a UIViewController instance using build closure.
Usage
let productScreen = StepAssembler<ProductViewController, ProductContext>()
.finder(.classWithContextFinder)
.factory(.build { ProductViewController(context: $0) })
.adding(ContextSettingTask())
.using(.push)
.from(.navigationController)
.using(.present)
.from(.current)
.assemble()
Might be useful for the configuration testing.
-
Type of
UIViewControllerthatFactorycan buildDeclaration
Swift
public typealias ViewController = VC -
Contextto be passed intoUIViewControllerDeclaration
Swift
public typealias Context = C
-
Constructor
Declaration
Swift
@MainActor public init(viewController inlineBock: @autoclosure @escaping () throws -> VC)Parameters
inlineBockthe block to be called when
InlineFactory.build(...)is requested. -
Constructor
Declaration
Swift
@MainActor public init(_ inlineBock: @escaping (C) throws -> VC)Parameters
inlineBockthe block to be called when
InlineFactory.build(...)is requested. -
Declaration
Swift
@MainActor public func build(with context: C) throws -> VC
-
Shorthand to be used as
.factory(.build(...))Declaration
Swift
@MainActor static func build(_ buildBlock: @escaping (Context) -> ViewController) -> InlineFactory