Android-CleanArchitecture-Kotlin icon indicating copy to clipboard operation
Android-CleanArchitecture-Kotlin copied to clipboard

Divide ViewModelModule into several feature based module?

Open jaychang0917 opened this issue 6 years ago • 2 comments

In a real-world app, there will be many features. Currently the ViewModelModule is responsible to provide all the ViewModels, is it better that each feature gets its ViewModels from its own component instead of the ApplicationComponent?

jaychang0917 avatar Jun 08 '18 07:06 jaychang0917

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.

android10 avatar Jun 25 '18 12:06 android10

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

aaghan avatar Apr 09 '20 18:04 aaghan