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.

Associated types

  • Type of UIViewController that Factory can build

    Declaration

    Swift

    public typealias ViewController = VC
  • Context to be passed into UIViewController

    Declaration

    Swift

    public typealias Context = C

Functions

  • Constructor

    Declaration

    Swift

    @MainActor
    public init(viewController inlineBock: @autoclosure @escaping () throws -> VC)

    Parameters

    inlineBock

    the block to be called when InlineFactory.build(...) is requested.

  • Constructor

    Declaration

    Swift

    @MainActor
    public init(_ inlineBock: @escaping (C) throws -> VC)

    Parameters

    inlineBock

    the block to be called when InlineFactory.build(...) is requested.

  • Declaration

    Swift

    @MainActor
    public func build(with context: C) throws -> VC

Shorthands

  • Shorthand to be used as .factory(.build(...))

    Declaration

    Swift

    @MainActor
    static func build(_ buildBlock: @escaping (Context) -> ViewController) -> InlineFactory