17 lines
318 B
Swift
17 lines
318 B
Swift
import Foundation
|
|
|
|
@propertyWrapper
|
|
public struct Injected<T> {
|
|
|
|
private let keyPath: KeyPath<InjectionValues, T?>
|
|
|
|
@MainActor
|
|
public var wrappedValue: T {
|
|
DIContainer.shared.resolve(keyPath)
|
|
}
|
|
|
|
public init(_ keyPath: KeyPath<InjectionValues, T?>) {
|
|
self.keyPath = keyPath
|
|
}
|
|
|
|
}
|