Hi, Is it possible to use Kodein when developing a...
# compose-ios
s
Hi, Is it possible to use Kodein when developing a Compose Multiplatform Android&IOS application?
👌 2
r
At the moment the iOS API is not super-friendly, so you have to set up a small bridge the exposes the dependencies to iOS. But otherwise, it works well, and an iOS API is expected in the near future.
Join #kodein if you haven't already
s
How can I do
bridge
for IOS? For example, on Android I do init of Kodein like this:
Copy code
class AndroidApp : Application(), DIAware {

    override fun onCreate() {
        super.onCreate()
    }

    override val di: DI by DI.lazy {
        import(appModuleDI)
        import(androidModuleDI)
    }
}
How do I do the same thing on iOS?
My goal is to inject dependencies within composable functions and also for other classes. That is, I mean, I'm not going to use from native swift code
s
IF you are writing a Application fully in Compose Multiplatform or if you want your Graph to be available only on your Compose Multiplatform Screen you can use the extension
withDi
to initiate the Graph for the hole Compose application https://github.com/kosi-libs/Kodein/blob/master/framework/compose/kodein-di-framework-compose/src/commonMain/kotlin/org.kodein.di.compose/withDI.kt