GlobalInjector
public final class GlobalInjector<K: ProvidableKey>: InjectorDerivingFromMutableInjector,
MutableInjector
Wraps a given MutableInjector
in order to add reference semantics.
-
Declaration
Swift
public typealias Key = K
-
Initializes
AnyInjector
with a givenInjector
.Parameters
injector
The
Injector
that shall be wrapped. -
Creates a deep copy of
GlobalInjector
with the same contents. Overrides defaultInjectorDerivingFromMutableInjector.copy()
.Declaration
Swift
public func copy() -> GlobalInjector
Return Value
A new
GlobalInjector
. -
Implements
MutableInjector.resolve(key:)
Declaration
Swift
public func resolve(key: Key) throws -> Providable
-
Implements
MutableInjector.provide(key:usingFactory:)
Declaration
Swift
public func provide( key: Key, usingFactory factory: @escaping (inout GlobalInjector) throws -> Providable )
-
Declaration
Swift
public func revoke(key: K)
-
Implements
Injector.providedKeys
by passing the internal provided keys.Declaration
Swift
public var providedKeys: [K] { get }
-
Creates a strict global injector.
Declaration
Swift
public convenience init()