Can suspend methods on Kotlin Multiplatform be acc...
# multiplatform
t
Can suspend methods on Kotlin Multiplatform be accessed by iOS or Android?
k
suspend is removed by K/N
t
Sorry, what is K/N? Kotlin/Native?
k
yes
t
thank you!
Is the only way to use the suspend function by putting it in a coroutine launch?
k
on JVM platforms
t
jvm and native
k
how would you use coroutines from iOS?
t
Make function A() in the kotlin multiplatform common that has a kotlinx coroutines that launches a suspend function. Then on the iOS side, call function A()
k
are you asking about suspend from your multiplatform library API, or using suspend functions from within your iOS source set?
t
from the library
but some how call it in the iOS source set
k
what is it you are trying to accomplish
t
calling ktor HttpClient get method
k
have you mentioned it in #ktor ?
t
I have but no one responded yet. I assume to tried this channel
s
Kotlin code running in iOS can call suspend functions. Suspend functions are not exposed to ObjC/Swift since there is nothing equivalent in those languages.
t
Ah! that makes sense. thank you for the clarification