GenericProvidableKey
public struct GenericProvidableKey<T>: ProvidableKey, RawRepresentable, ExpressibleByStringLiteral,
CustomStringConvertible, CustomDebugStringConvertible
A generic implementation of ProvidableKey
.
It may be used in your applications to get rid of stringly typed properties or keys.
Typically you will declare empty types for each use case. These empty types are only used in order to fulfill constraints.
enum ServicesKeyType { } // will never be instantiated
typealias Services = GenericProvidableKey<Services>
let serviceInjector = LazyInjector<Services>().globalize().erase()
serviceInjector // only Services will fit in here
-
The name of the represented key.
Declaration
Swift
public let name: String
-
Initializes a new
GenericProvidableKey
.Declaration
Swift
public init(name: String)
Parameters
name
The name of the key.
-
Declaration
Swift
public var description: String { get }
-
Declaration
Swift
public var debugDescription: String { get }
-
Declaration
Swift
public var rawValue: String { get }
-
Declaration
Swift
public init?(rawValue: String)
-
Declaration
Swift
public var hashValue: Int { get }
-
Declaration
Swift
public static func == (lhs: GenericProvidableKey, rhs: GenericProvidableKey) -> Bool
-
Declaration
Swift
public init(stringLiteral value: String)
-
Declaration
Swift
public init(extendedGraphemeClusterLiteral value: String)
-
Declaration
Swift
public init(unicodeScalarLiteral value: String)