Workflow with this library #233
Unanswered
zveljkovic
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As a DI library this is great thing to have when developing the mobile app. I am looking for a proper way to use it when working with Swift UI.
Current approach
Is there some general guide on how to structure the app with SwiftUI and this library? I would really like that I can inject everything in the view model (both Service and ServiceModel classes) and to observe both injected models and/or computed properties (getter functions) and also have a code that triggers updates in ViewModel so I can adjust the state. But for now this eludes me...
EDIT
Figured out a way that is better then above but it relies on singleton implementation. It works by putting the same dep inside the view model and the view. (I have merged service model classes into service class). As long as the observable state inside the view, it doesn't care from where it is changed. That allowed to inject same dependency into ViewModel class and use state and functions from there.
Beta Was this translation helpful? Give feedback.
All reactions