InjectedProviderResolveState
public enum InjectedProviderResolveState<K> : CustomDebugStringConvertible where K : Hashable
Stores the result when evaluating a factory provided
by Injector.providing(key:usingFactory:)
and similar methods
in order to ‘replay’ it.
-
When an error occured. If the error was of type
InjectionError
it will be passed otherwise it will be wrapped inInjectionError.customError
.Declaration
Swift
case failure(InjectionError<K>)
-
Contains the constructed value.
Declaration
Swift
case success(Providable)
-
Evaluates the passed factory.
Declaration
Swift
public init<I: Injector>( withInjector injector: inout I, from factory: (inout I) throws -> Providable ) where I.Key == K
Parameters
injector
The injector that shall be used.
factory
The factory that shall be evaluated.
-
Constructs a factory and returns its
InjectedProviderResolveState
.Declaration
Swift
public static func from<I: Injector>( factory: (inout I) throws -> Providable, for injector: inout I ) -> InjectedProviderResolveState where I.Key == K
Parameters
injector
The injector that shall be used.
factory
The factory that shall be evaluated.
Return Value
InjectedProviderResolveState.failure
when factory throwed,InjectedProviderResolveState.success
otherwise. -
Either throws or returns the value.
Throws
On caseInjectedProviderResolveState.failure
.Declaration
Swift
public func resolve<I: Injector>(withInjector injector: inout I) throws -> Providable where I.Key == K
Parameters
injector
Will be ignored.
Return Value
On case
InjectedProviderResolveState.success
. -
Declaration
Swift
public var debugDescription: String { get }