diff --git a/di/README.md b/di/README.md index 358c956..f563972 100644 --- a/di/README.md +++ b/di/README.md @@ -99,12 +99,7 @@ The actual provides are declared in the sub-module: @Module class HomeFragmentSubModule { - @Provides - @FragmentScope - internal fun provideViewModel( - homeInteractor: HomeInteractor, - settingsInteractor: SettingsInteractor - ) = HomeViewModel(homeInteractor, settingsInteractor) + // provide @FragmentScope annotated dependencies here } ``` @@ -137,9 +132,16 @@ class HomeFragment : Fragment(), HasSupportFragmentInjector { There is not much to do for ViewModels except for adding a constructor annotated with `@Inject`: ```kotlin +@FragmentScope class HomeViewModel @Inject constructor(/* inject properties here if you want */) : ViewModel() {} ``` +## For each Interactor/Repository + +Interactors and repositories are usually also provided right the same like ViewModels and scoped as `Singleton` or `FragmentScope`/`ActivityScope`. + +Using modules is rarely needed to provide them. + ## What else do I need? Due to the nature of how libraries and dagger work we cannot provide all necessary classes to get DI up and running.