Created
August 19, 2018 10:20
-
-
Save tfcporciuncula/f747d060c83fe559edff4fb24b304a8f to your computer and use it in GitHub Desktop.
ApplicationComponent-with-builder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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