Hello, I have a Kotlin Multiplatform project. Is p...
# dagger
l
Hello, I have a Kotlin Multiplatform project. Is possible to use Dagger in androidMain and access classes from commonMain (superclasses)? Thank you.
a
https://github.com/evant/kotlin-inject is a better choice for multiplat
👍 1
l
@Arun I have an existing project, you didn't reply my question.
t
It is possible, yes. Just add the dagger/hilt plugin to your module’s build.gradle, and perform your DI logic in the androidMain source set
The classes don’t need to be ‘superclasses’ - they can just be regular commonMain classes. Your dagger @Module is just defining how to provide instances of those classes. You don’t need expect/actual or whatever