Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Coroutine Flow in Swift

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?

like image 986
saiedmomen Avatar asked Nov 18 '25 23:11

saiedmomen


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.

like image 65
Róbert Nagy Avatar answered Nov 20 '25 22:11

Róbert Nagy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!