Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Updated Dagger Module
interface AppComponent {
@Component.Factory
interface Factory {
fun create(@BindsInstance context: Context): AppComponent
}
.....
fun getInitializers(): Map<Class<out ModuleInitializer>, @JvmSuppressWildcards ModuleInitializer>
@Module
abstract class InitializerModule {
@Binds
@IntoMap
@InitializerKey(CustomerCareInitializer::class)
abstract fun customerCareInitializer(initializer: CustomerCareInitializer): ModuleInitializer
@Binds
@IntoMap
@InitializerKey(SubscriptionInitializer::class)
abstract fun subscriptionInitializer(initializer: SubscriptionInitializer): ModuleInitializer
}
@MustBeDocumented
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
@MapKey
annotation class InitializerKey(val value: KClass<out ModuleInitializer>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment