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

Tobias

02/14/2023, 10:46 AM
Do I really need nowadays dependencies like
KMP-NativeCoroutines
to work smoothly with a shared core in an iOS app? I thought I read something that KMM made the
async / await
bridge into iOS more stable and accessable without any third party framework?
j

John O'Reilly

02/14/2023, 10:52 AM
The default framework has made it easier to invoke suspend functions but some caveats there as well. Where KMP-NativeCoroutines shines is when consuming say Flow/StateFlow etc from shared code. A flow for example appears as Swift AsyncSequence along with cancellation propagation etc. If you're also using related KMM-ViewModel library then a StateFlow from a shared view model can be observed directly in your SwiftUI.
r

Rick Clephas

02/14/2023, 11:08 AM
What @John O'Reilly said. The major limitation with suspend/async function is that cancellation isn’t supported (because in ObjC everything is still a callback).
t

Tobias

02/14/2023, 11:26 AM
Ah, thanks folks for the explanation!
k

Kirill Zhukov

02/14/2023, 6:46 PM
And we lose Flow generics in ObjC, which
KMP-NativeCoroutines
addresses, yeah?
r

Rick Clephas

02/14/2023, 6:51 PM
Correct (as long as the Flow generic argument isn't a generic itself).
48 Views