Android-CleanArchitecture-Kotlin
Android-CleanArchitecture-Kotlin copied to clipboard
Divide ViewModelModule into several feature based module?
In a real-world app, there will be many features. Currently the ViewModelModule
is responsible to provide all the ViewModel
s, is it better that each feature gets its ViewModel
s from its own component instead of the ApplicationComponent
?
What you are saying is more than valid, but DI was out of scope and using Dagger is an implementation detail.
With that being said we could use this issue to discuss about different approaches we can take regarding DI.
I inherited ViewModelFactoryModule in different module to achieve it. It came quite hard to figure out injection could not be done unless one viewmodel injects in constructor