hey all :wave: i'm having a hard time to setup cor...
# multiplatform
p
hey all 👋 i'm having a hard time to setup coroutines in
commonMain
, do you know a simple example out there? i want to get rid off
freeze
from iOS impl and understood that's not needed anymore starting with kotlin coroutines
1.6.0
my use case is simple i want to translate 👇 to use coroutines common
Copy code
internal expect fun Recorder.stop(result: (String?) -> Unit)
class Sandbox(private val recorder: Recorder) {

    /**
     * stop
     *
     * @param result
     */
    fun stop(result: (String?) -> Unit) {
        recorder.stop(result)
    }
}
ios
Copy code
internal actual fun Recorder.stop(result: (String?) -> Unit) {
    val callback: IosSandboxCallback = {
        result(it)
    }
    callback.freeze()
    this.stopRecordingForResult(callback)
}
android
Copy code
internal actual fun Recorder.stop(result: (String?) -> Unit) =
    this.stopRecording { result(it) }
so basically suspend
recorder.stop
until executes and then put the result back in main, anyone?