Context in viewModel #2942
Amir-yazdanmanesh
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
I completely agree with you because it is hard to read and test. It is not only the viewModel that is very attached to Android components, but other components are also very dependent on each other, and changing one of them affects the other. I think it is a very good suggestion. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've noticed that MainViewModel is tightly coupled with the Android Context, which goes against the best practice of keeping ViewModels independent of any Android framework components. I understand the importance of making ViewModels agnostic to the UI layer for better testability and reusability. I'm open to restructuring my codebase to remove any dependencies on the Context and separating out any view-related logic into appropriate view components.
Beta Was this translation helpful? Give feedback.
All reactions