Stylianos Gakis
11/05/2025, 3:55 PMFrançois
11/05/2025, 4:02 PMJohn O'Reilly
11/05/2025, 4:04 PMJohn O'Reilly
11/05/2025, 4:05 PMObservingFrançois
11/05/2025, 4:05 PMStylianos Gakis
11/05/2025, 4:29 PMStylianos Gakis
11/05/2025, 4:30 PMRick Clephas
11/05/2025, 5:14 PMFlow interface (can be easily resolved by exposing a generic class)
2. using a suspend function and supporting cancellation
If you just need to expose a single Flow and don’t really care about how it should be consumed in Swift then you can create some basic function.
E.g. https://pl.kotl.in/Wmz4CAGm6
Keep in mind that it’s a basic example. You likely want to handle exceptions, must make sure to cancel the collection from Swift, need to pick a CoroutineScope/Dispatcher that makes sense, etc.Stylianos Gakis
11/05/2025, 8:47 PMdo {
asyncSequence(for...
} catch {
}
function and that should be all there is to it?
The docs don't look to have an annotation that needs to be applied to the function which returns flow right?Guillaume B
11/05/2025, 9:28 PMRick Clephas
11/05/2025, 9:41 PMUsing your library, I would just need the “KMPNativeCoroutinesAsync” part, and to use the function and that should be all there is to it?
The docs don’t look to have an annotation that needs to be applied to the function which returns flow right?If you want to use KMP-NativeCoroutines, you’ll need to annotate your Flow function or property with
@NativeCoroutines.
The plugin and Swift helper functions will handle things like exceptions, cancellations mapping, etc.Rick Clephas
11/05/2025, 9:42 PMIsn’t swift export feature supposed to help us with ?Yes Swift export is currently under development (incl support for coroutines). But once complete it will indeed provide proper support for coroutines from Swift
dylan
11/06/2025, 9:58 AMdylan
11/06/2025, 10:00 AMStylianos Gakis
11/06/2025, 10:46 AMStylianos Gakis
11/07/2025, 2:55 PMfun foo(suspend block: () -> Unit)
Or what should one do in such a scenario?Rick Clephas
11/07/2025, 3:00 PM