UIHostingControllerFactory

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
public struct UIHostingControllerFactory<ContentView, Context> : Factory where ContentView : View

Builds UIHostingController with ContentView as a UIHostingController.rootView using the provided block.

Associated types

  • Declaration

    Swift

    public typealias ViewController = UIHostingController<ContentView>
  • Declaration

    Swift

    public typealias Context = Context

Methods

  • Constructor

    Declaration

    Swift

    public init(_ buildBlock: @escaping (Context) -> ContentView)

    Parameters

    buildBlock

    Block that builds the View with the using the Context instance provided.

  • Declaration

    Swift

    public func build(with context: Context) throws -> UIHostingController<ContentView>