Closed hydro1337x closed 3 years ago
If you use @InjectedObject your registrations need to be scoped, usually as "shared".
register { DataSource() }.scope(.shared)
This will let DataSource persist for as long as there's a Counter view in the view graph.
I started using Resolver in combination with SwiftUI and noticed that there is no way to inject an @StateObject property. I used the @InjectedObject wrapper but the problem with it or better to say with ObservedObjects is that they do not store the state if the view in which they are declared redraws itself.
Potential solution
Demo project