Can someone head me in the right direction using t...
# multiplatform
h
Can someone head me in the right direction using the expect/actual mechanism to have a CoroutineDispatcher (MainThread/singleThread/UI) that works on Andorid, iOS and in tests on a plain JVM? If I integrate the solution presented here: https://github.com/Kotlin/kotlinx.coroutines/issues/470#issuecomment-440080970 I'm unable to provide an actual implementation for the jvm target
e
In common code:
Copy code
expect val MainDispatcher: CoroutineDispatcher
In JVM code:
Copy code
actual val MainDispatcher: CoroutineDispatcher get() = Dispatchers.Main
In iOS code:
Copy code
actual val MainDispatcher: CoroutineDispatcher get() = MainLoopDispatcher // from that solution
h
My mistake was that I was trying to expect/actual an object instead of a val. Thanks! 👍