Hi. ```Calling Kotlin suspend functions from Swif...
# kotlin-native
c
Hi.
Copy code
Calling Kotlin suspend functions from Swift/Objective-C is currently supported only on main thread
I’m using KTOR 2.0.0 with the new memory model. Getting this error when trying to call an async func inside a Task from this iOS side. There’s currently something I can do to be able to call that function in that context?
Consider writing your own wrapper code to pass a callback instead of depending on the auto-generated one.
j
h
or annotate the Swift function with
@MainActor
c
I tried using @MainActor but it keeps crashing 😞
I’ll try with NativeCoroutines. It seems to be a good option. I’m going to update this as soon as I get any results. Tks guys !
j
Another nice thing about that library is that you can integrate with swift async/await
145 Views