Hello! Can someone please explain me how to proper...
# koin
m
Hello! Can someone please explain me how to properly inject in iOS? I’ve read this several times and I still can’t get it
Especially this: // Koin.kt fun getUserPresenter() : UserPresenter = KoinPlatform.getKoin().get() Where doors this come from? What’s koin.kt? What’s KoinPlatform.kt?
Basically, that Koin.kt file is the injection part declared in the iosMain of the shared module, that's what are you going to call from the iOS app
f
I can give you something more dynamic
👏 1
👏🏻 1
m
@Alejandro Rios I did look into the code, but it just doesn’t work for me: I want to inject a DAO from Room, and I do:
Copy code
import org.koin.core.module.Module
import org.koin.dsl.module
import org.koin.mp.KoinPlatform

actual fun platformModule(): Module = module {
    single<LiftDatabase> {
        getDatabase(getDatabaseBuilder())
    }
}

fun getLiftsDao(): LiftDao = KoinPlatform.getKoin().get()
then in iOS I do:
*let* liftsDao = KoinKt.getLiftsDao()
and I get:
Copy code
iosApp/DI/ViewModelFactory.swift:8:35 Type 'KoinKt' has no member 'getLiftsDao'