Skip to content

ComponentSingletonProvider

ctreffs edited this page Oct 8, 2020 · 1 revision

ComponentSingletonProvider

This component provider always returns the same instance of the component. The instance is created when first required and is of the type passed in to the initializer.

public final class ComponentSingletonProvider

Inheritance

ComponentProvider

Initializers

init(type:)

Initializer

public init(type: ComponentInitializable.Type)

Parameters

  • type: The type of the single instance

Properties

identifier

Used to compare this provider with others. Any provider that returns the same single instance will be regarded as equivalent.

var identifier: AnyHashable

Returns

ObjectIdentifier of the single instance

Methods

getComponent()

Used to request a component from this provider

public func getComponent() -> Component

Returns

The single instance

Clone this wiki locally