Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. //Component
  2. @Singleton
  3. @Component(modules = [AppModule::class, InjectorBuilderModule::class])
  4. interface AppComponent : AndroidInjector<App>
  5.  
  6. //Module
  7. @Module
  8. class MainModule {
  9.  
  10. @Provides
  11. internal fun provideViewModelFactory(): MainVMFactory {
  12. return MainVMFactory()
  13. }
  14. }
  15.  
  16. //Application
  17. class App : DaggerApplication() {
  18.  
  19. override fun applicationInjector(): AndroidInjector<out DaggerApplication> {
  20. return DaggerAppComponent.builder().build()//.appModule(AppModule(this)).build()
  21. }
  22. }
  23.  
  24. //in onCreate Activity
  25. AndroidInjector.inject(this)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement