Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ursusursus/4752ac4be5c3fe5743877a9a84ae68ee to your computer and use it in GitHub Desktop.
Save ursusursus/4752ac4be5c3fe5743877a9a84ae68ee to your computer and use it in GitHub Desktop.
@AppScope
@Component
interface AppComponent {
val userComponentFactory: UserComponent.Factory
@Component.Factory
interface Factory {
fun create(@BindsInstance context: Context): AppComponent
}
}
@UserScope
@Subcomponent
interface UserComponent {
val parent: AppComponent
val subscriberComponentFactory: SubscriberComponent.Factory
@Subcomponent.Factory
interface Factory {
fun create(@BindsInstance userId: UserId): UserComponent
}
}
@SubscriberScope
@Subcomponent
interface SubscriberComponent {
val what: UserComponent .... makes compile Stackoverflow
@Subcomponent.Factory
interface Factory {
fun create(@BindsInstance subscriberId: SubscriberId): SubscriberComponent
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment