Hi! Is there still no way to implement this interface in iOS?
Copy code
interface Props {
fun payload(): Flow<MyPayload>
}
Last time I tried it there were problems a) with the fact that Flow<T> is a generic type b) no Flow accessible in Kotlin/Native.
If not, what's the best thing I could do to get something similar working?
a
aiidziis
05/07/2020, 4:35 PM
You can pass completion as parameter.
Copy code
interface Props {
fun payload(completion: (MyPaylod) -> Unit)
}
d
dimsuz
05/07/2020, 4:36 PM
yeah, but its not really a reactive stream...
a
aiidziis
05/07/2020, 4:38 PM
You can probably wrap it on iOS side with your desired reactive library wrapper. (RxSwift, ReactiveCocoa, Combine., etc.)
👍 1
d
Derek Ellis
05/07/2020, 4:47 PM
You can't do much with a flow since most of its useful methods are suspend functions which aren't made visible in Obj-C. There are ways around that, but the CFlow solution that the KotlinConf app uses is pretty clever too (now that generics are mostly available in Obj-C interop)