Do I really need nowadays dependencies like `KMP-N...
# multiplatform
t
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
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
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
Ah, thanks folks for the explanation!
k
And we lose Flow generics in ObjC, which
KMP-NativeCoroutines
addresses, yeah?
r
Correct (as long as the Flow generic argument isn't a generic itself).