Skip to content

Commit

Permalink
Update InjectedObject to pass type to StateObject
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlongco committed Oct 28, 2023
1 parent 1a103ba commit 4853758
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/Factory/Factory/Injections.swift
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,12 @@ import SwiftUI
/// Initializes the property wrapper. The dependency is resolved on initialization.
/// - Parameter keyPath: KeyPath to a Factory on the default Container.
public init(_ keyPath: KeyPath<Container, Factory<T>>) {
self._dependency = StateObject(wrappedValue: Container.shared[keyPath: keyPath]())
self._dependency = StateObject<T>(wrappedValue: Container.shared[keyPath: keyPath]())
}
/// Initializes the property wrapper. The dependency is resolved on initialization.
/// - Parameter keyPath: KeyPath to a Factory on the specified Container.
public init<C:SharedContainer>(_ keyPath: KeyPath<C, Factory<T>>) {
self._dependency = StateObject(wrappedValue: C.shared[keyPath: keyPath]())
self._dependency = StateObject<T>(wrappedValue: C.shared[keyPath: keyPath]())
}
/// Manages the wrapped dependency.
public var wrappedValue: T {
Expand Down

0 comments on commit 4853758

Please sign in to comment.