Provider
public struct Provider<K, V> : CustomDebugStringConvertible where K : Hashable
Adds type information to a ProvidableKey
.
-
Type of
Providable
s that will be associated withProvider.key
.Declaration
Swift
public typealias Value = V
-
Type of
ProvidableKey
s that shall be represented.Declaration
Swift
public typealias Key = K
-
The represented key of the
Provider
.Declaration
Swift
public let key: K
-
Initializes a generic
Provider
representing the givenProviderKey
.Declaration
Swift
public init(for key: K)
Parameters
key
The represented
ProviderKey
. -
Declaration
Swift
public var debugDescription: String { get }
-
Automatically generates
Provider#key
from the caller’s function and the detected type.Declaration
Swift
public static func derive<V: Providable, K: ProvidableKey & ExpressibleByStringLiteral>( function: String = #function ) -> Provider<K, V> where K.StringLiteralType == String
Parameters
function
The function where
.derive()
will be called from.Return Value
A new
Provider
with aString
asProvidableKey
, containing type information and the caller’sfunction
.