我们目前如何从 swift 收集Flow?
有了新的Support for Kotlin’s suspending functions in Swift flow 的 collect
方法在 swift 中获得了这个相当笨重的签名
vm.topStoriesFlow.collect(
collector: Kotlinx_coroutines_coreFlowCollector,
completionHandler: @escaping (KotlinUnit?, Error?) -> Void
)
知道如何使用它,甚至目前是否支持它的使用?
最佳答案
正如 Kevin 所说,一种可能且流行的方法是创建包装器。你可以看看kotlinconf-app/CFlow了解更多信息。
关于kotlin - 在 Swift 中使用协程流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63748022/