https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
u

Uri Abad

08/27/2020, 7:16 AM
Hi guys! First comment here!!!😁 Do you have any workaround to be able to test coroutines in native enviroment?? I just had this workaround to make common test works against JVM, but I couldn't find any solution for native:
Copy code
//Common
expect fun runBlockingAdapter(block: suspend () -> Unit)

//JVM
actual fun runBlockingAdapter(block: suspend () -> Unit) = kotlinx.coroutines.runBlocking { block() }

//Native
actual fun runBlockingAdapter(block: suspend () -> Unit) {
    throw UnsupportedOperationException()
}
m

Marc Knaup

08/27/2020, 9:45 AM
runBlocking
should work just fine on native.
u

Uri Abad

08/27/2020, 7:56 PM
I was trying to include coroutine library on common instead of implementing at ios module. Thanks! :D
2 Views