Hello mates :wave: Can I please have an updated a...
# kodein
f
Hello mates 👋 Can I please have an updated answer about Kodein DI within the iOS module of a Kotlin Multiplatform Project? I read from slack messages, I need to build a bridge Utility class. Does this still apply? Thanks
r
I’m not sure to understand your question ? Do you mean binding from iOS source set ? Accessing binding from Swift ?
f
I'm sorry, I meant injecting, creating modules etc from the iOS side of a Kotlin Multiplatform.
r
So binding Swift types ?
f
Copy code
object CommonInjector {
    @ApolloExperimental
    val kodein = DI.lazy {
        import(sharedKodein)
    }

    @ExperimentalCoroutinesApi
    fun searchStore() = kodein.direct.instance<SearchStore>()

}
this ^, is this the right way to inject instances from Swift ?
then in swift ...
Copy code
init() {
        store = CommonInjector().searchStore()
r
Yes it is the simplest way to retrieve dependencies from Swift right now.
However, it is possible to inject instances from Swift by defining few utils from both side (Kotlin and Swift)
👍 1
I might be able to share a Gist to show you how in the next days
👌 1
👀 1