Add @Injected property wrapper

This commit is contained in:
Brendan Szymanski 2026-06-10 17:21:54 -04:00
parent e829b8141b
commit 44b5a02ab6

View file

@ -0,0 +1,17 @@
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
}
}