Hello everybody. I have a question when using koin...
# koin
r
Hello everybody. I have a question when using koin.
I have an interface and its implementation and I configured it like this:
val moduleTest= module {
scope<SomeInterface> { SomeImplementation() }
}
and registered the module
install(Koin) {
slf4jLogger()
modules(moduleTest)
}
Now I wanted to use the class when calling the interface.
class SomeClass(impl: Interface) {
val useImpl = i got lost here.
}
But I don't know how to do that. I tried
val impl= get<SomeInterface>()
but it did not work.
l
I think you want to be using
single
instead of
scope
. You're not using the scope for anything, that's why it's getting lost
👍 1
What you're creating instead is Scope: https://insert-koin.io/docs/reference/koin-core/scopes Which is completely different from what you want