Closed lyzkov closed 1 year ago
Nope. Property wrappers are structs. To do lazy property wrappers you have to mutate the struct value. And you can't mutate an "observable object" property wrapper installed on a View.
I provided an InjectedObject wrapper for Factory, but at some point I'm probably going to mark it as deprecated, especially with the advent of @Observable in iOS 17.
Best to stick with @StateObject and inject needed dependencies into the view model when needed.
I have failed to create an
@InjectedLazyObject
property wrapper that could resolve dependency upon access towrappedValue
orprojectedValue.
Is there any hope that it is possible? CouldObservedObject<DependencyType>
be created by Factory and injected with@LazyInjected
?