(Kotlin/Native) Suspendable functions inside iOS framework



I’ve run into quite an issue lately. We are using suspend func inside common project but it’s not being generated in iOS framework.

Any way how to fix this or any workaround?

What I mean is for example this piece of code

interface CommandHandler<in T : Command> {

    suspend fun handle(command: T)

will only generate this inside of objc framework

@protocol PrefixCommandHandler

I would be really grateful for any help. Thank you.


workaround is use class Continuation for callbacks. see https://github.com/shakurocom/kotlin_multiplatform/blob/master/platform-ios/src/main/kotlin/com/multiplatform/model/repository/ReposRepository.kt (kotlin common-ios part) & https://github.com/shakurocom/kotlin_multiplatform/blob/master/ios/KMultiplatform/model/repository/ReposRepository.swift (ios app part)
also useful link - https://android.jlelse.eu/building-multiplatform-project-on-kotlin-native-85febff784e8