Skip to content

Instantly share code, notes, and snippets.

@tfcporciuncula
Created April 8, 2019 09:16
Show Gist options
  • Save tfcporciuncula/5f6c5d2c3e02ff8cc5c100035fd4a515 to your computer and use it in GitHub Desktop.
Save tfcporciuncula/5f6c5d2c3e02ff8cc5c100035fd4a515 to your computer and use it in GitHub Desktop.
BookInjection.kt
@Subcomponent
interface BookComponent {
@Subcomponent.Factory
interface Factory {
fun create(@BindsInstance bookView: BookView): BookComponent
}
val presenter: BookPresenter
}
@Component(modules = ...)
interface ApplicationComponent {
...
val bookComponentFactory: BookComponent.Factory
}
// and in the Activity
private val presenter =
MyApplication
.component
.bookComponentFactory
.create(this)
.presenter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment