Skip to content

Instantly share code, notes, and snippets.

@tfcporciuncula
Created August 19, 2018 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfcporciuncula/f747d060c83fe559edff4fb24b304a8f to your computer and use it in GitHub Desktop.
Save tfcporciuncula/f747d060c83fe559edff4fb24b304a8f to your computer and use it in GitHub Desktop.
ApplicationComponent-with-builder
@Singleton
@Component(modules = [YourModule::class, ThatOtherModule::class])
interface ApplicationComponent {
@Component.Builder
interface Builder {
@BindsInstance fun applicationContext(applicationContext: Context): Builder
fun build(): ApplicationComponent
}
}
class YourApplication : Application() {
val component: ApplicationComponent by lazy {
DaggerApplicationComponent.builder()
.applicationContext(applicationContext)
.build()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment