Closed muazkadan closed 1 month ago
was it working in RC1 or previous?
Yes, the code below with 4.0.0-RC1
@Composable
fun App() {
KoinApplication(application = {
modules(personModule)
}) {
val person = koinInject<Person>()
println("Person: ${person.hashCode()}")
Scaffold {
val person2 = koinInject<Person>()
println("Person2: ${person2.hashCode()}")
}
}
}
prints on iOS:
Person: 144249656
Person: 144249656
Person2: 144249656
updated in 7bd030cd9c38478838a82b75904d3d5df5752e96 Reopen if on next release the issue come back 👍
Hello,
I'm having a problem with my Compose Multiplatform project (Android & iOS) where injected objects are acting different on each platform
To demonstrate the issue, I tried the sample code below:
On Android the code printed
Person: 2409473
While on iOS I got:
The weird thing happens when I add a Scaffold to the Compose hierarchy like this:
on android I got:
While on iOS I got:
Not sure if this is a problem with Koin or Compose Multiplatform And not sure if initializing koin and declaring modules in the shared code is true
In my project I'm using DataStore Preferences similarly as above which is causing the iOS app to crash as I can't create multiple instances of the same data store
Any help would be greatly appreciated