Alberto
07/24/2020, 5:14 PMArkadii Ivanov
07/24/2020, 5:26 PMAlberto
07/24/2020, 5:35 PMArkadii Ivanov
07/24/2020, 5:38 PMSam
07/24/2020, 5:56 PMAlberto
07/24/2020, 5:57 PMkpgalligan
07/24/2020, 7:51 PMspierce7
07/24/2020, 7:52 PMAlberto
07/24/2020, 7:53 PMSam
07/24/2020, 8:35 PMzsperske
07/24/2020, 8:47 PMgetKClass
somewhere internallySam
07/24/2020, 8:48 PMkpgalligan
07/24/2020, 8:50 PMrusshwolf
07/24/2020, 8:52 PMAny
first to avoid KClass issues, but then you lose type safety and need to use qualifiers to manually distinguish things. Much cleaner if you wrap in a Kotlin object.Michal Harakal
07/27/2020, 5:47 AMzsperske
07/27/2020, 1:55 PMDatabaseDriverIos
that implements an interface you defined in kotlin called DatabaseDriver
which you want to provide to Koin when your app startsclass DatabaseDriverWrapper(private val databaseDriverImpl) : DatabaseDriver by databaseDriverImpl
DatabaseDriverIos
russhwolf
07/27/2020, 3:36 PMDatabaseDriver
is a Kotlin type then as long as you cast to that in your Koin code you probably don't need the wrapper. eg you could define
fun configureKoin(databaseDriver: DatabaseDriver) {
startKoin(modules(module {
...
single { databaseDriver }
}))
}
and then call configureKoin()
from Swift. But if DatabaseDriverIos
doesn't implement a Kotlin interface then you'd want a wrapper like class DatabaseDriverWrapper(val databaseDriverIos: DatabaseDriverIos)
to be able to bind it to Koin.
(sorry to take this thread off the rails)Michal Harakal
07/27/2020, 5:24 PM