Pedro Francisco de Sousa Neto
09/12/2023, 12:03 AMmodule {
singleOf(::ClassA)
singleOf(::ClassB)
singleOf(::ClassC)
}
But how can I call this “regular usage”?
module {
single<ClassA>{ ClassAImpl() }
single<ClassB>{ ClassBImpl() }
single<ClassC>{ ClassCImpl() }
}
arnaud.giuliani
09/12/2023, 7:12 AMsingleOf
I named it "constructor dsl", it is intended to target function directly. As opposed to Koin DSL (the classical one) that allow to write a functionVlad
09/12/2023, 10:02 AMsingleOf(::ClassAImp) {
bind<ClassA>()
}
Jacob Ras
09/12/2023, 3:50 PMmodule {
singleOf(::ClassAImpl) bind ClassA::class
}
If you use Koin-Annotations it's already binding by default 🙂 So then just having a ClassAImpl
makes it already be injected when requesting ClassA
.Pedro Francisco de Sousa Neto
09/12/2023, 9:00 PM