rickclephas / KMP-ObservableViewModel

Library to use AndroidX/Kotlin ViewModels with SwiftUI
MIT License
569 stars 29 forks source link

Module with the Main dispatcher is missing on desktop JVM #53

Closed estivensh closed 9 months ago

estivensh commented 9 months ago

when i try to use any function of the shared viewmodel from the jvm(desktop) target i get this error, even though i added the coroutines as the log suggests i still get the same error

Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' and ensure it has the same version as 'kotlinx-coroutines-core

rickclephas commented 9 months ago

Are you by any chance using Compose Multiplatform? If that's the case then adding the following dependency should provide the Main dispatcher:

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.7.3")
estivensh commented 9 months ago

Are you by any chance using Compose Multiplatform? If that's the case then adding the following dependency should provide the Main dispatcher:

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.7.3")

it worked perfectly, this should be added as an issue to add it in the library or it should be documented? so that other people do not have the same problem.

rickclephas commented 9 months ago

Great! I will make sure to update the README 👍🏻