Using Coroutine Flow in Swift

Viewed 1491

How can we currently collect Flow from swift?

With the new Support for Kotlin’s suspending functions in Swift flow's collect method gets this rather unwieldy signature in swift

vm.topStoriesFlow.collect(
 collector: Kotlinx_coroutines_coreFlowCollector,
 completionHandler: @escaping (KotlinUnit?, Error?) -> Void
)

Any idea how it might be used or even if its usage is currently supported?

1 Answers

As Kevin stated one possible and popular approach would be to create a wrapper. You can check out kotlinconf-app/CFlow for more info.

Related