Skip to content

DynamicComponentProvider

ctreffs edited this page Oct 8, 2020 · 1 revision

DynamicComponentProvider

This component provider calls a function to get the component instance. The function must return a single component of the appropriate type.

public final class DynamicComponentProvider<C: Component>

Inheritance

ComponentProvider

Initializers

init(closure:)

Initializer

public init(closure: Closure)

Parameters

  • closure: Instance of Closure class. A wrapper around closure that will return the component instance when called.

Properties

identifier

Used to compare this provider with others. Any provider that uses the function or method closure to provide the instance is regarded as equivalent.

var identifier: AnyHashable

Returns

ObjectIdentifier of closure

Methods

getComponent()

Used to request a component from this provider

public func getComponent() -> Component

Returns

The instance returned by calling the closure

Clone this wiki locally