Hi, I'm trying to implements an interface that r...
# multiplatform
f
Hi, I'm trying to implements an interface that returns Flows on swift, something like
callbackFlow {}
in Kotlin. For example:
Copy code
// Kotlin common
interface Repository {
    fun location(): Flow<LatLng>
}
Copy code
// Kotlin android
class AndroidRepository : Repository {
    override fun location(): Flow<LatLng> = 
        callbackFlow {
            // some implementation 
        }
}
How should I implements those on swift?
Copy code
// Swift iOS
class IosRepository : Repository {
    func location() -> // how to?
}
I'm already looking at the topics but unable to find anything that solves above issue. Am I missing something here?
h
Implementing (returning) Flow in Swift is hard. Instead implement your logic in Kotlin using platform.Foundation and use https://github.com/rickclephas/KMP-NativeCoroutines
f
Yup, I figure it is hard to right now to do what I want. Got some clearance on how some lib handle this kind of issue from this firebase-kotlin library: https://github.com/GitLiveApp/firebase-kotlin-sdk