I’ve a technical question about how to name it cer...
# koin
p
I’ve a technical question about how to name it certain usage in Koin. I know Koin annotations and DSL (like bellow).
Copy code
module {
    singleOf(::ClassA)
    singleOf(::ClassB)
    singleOf(::ClassC)
}
But how can I call this “regular usage”?
Copy code
module {
    single<ClassA>{ ClassAImpl() }
    single<ClassB>{ ClassBImpl() }
    single<ClassC>{ ClassCImpl() }
}
1
a
singleOf
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 function
🤝 1
v
Copy code
singleOf(::ClassAImp) {
  bind<ClassA>()
}
j
Copy code
module {
  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
.
p
Thanks guys!