Last active
April 7, 2019 14:12
-
-
Save tfcporciuncula/d24d515b86c6445eb77e71d447c52576 to your computer and use it in GitHub Desktop.
BookInjection.kt
This file contains hidden or 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
@Subcomponent | |
interface BookComponent { | |
@Subcomponent.Builder | |
interface Builder { | |
@BindsInstance fun bookView(bookView: BookView): Builder | |
fun build(): BookComponent | |
} | |
val presenter: BookPresenter | |
} | |
@Component(modules = ...) | |
interface ApplicationComponent { | |
... | |
// we can simply expose the subcomponent builder now | |
val bookComponentBuilder: BookComponent.Builder | |
} | |
// and here's how it looks like in the Activity | |
private val presenter = | |
MyApplication | |
.component | |
.bookComponentBuilder | |
.bookView(this) | |
.build() | |
.presenter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment