https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
n

Nikita Khlebushkin

10/30/2020, 8:12 PM
Hello! I’m writing a library for KMM, and I would need to have: commonMain/…/RxUtils.kt:
Copy code
expect class Observable<T>
androidMain/…/RxUtils.kt:
Copy code
actual typealias Observable<T> = io.reactivex.rxjava3.core.Observable<T>
…but:
s

saket

10/30/2020, 8:13 PM
expect/actual is a bit strict on the API signatures
n

Nikita Khlebushkin

10/30/2020, 8:13 PM
Is there a way to work around this?
s

saket

10/30/2020, 8:14 PM
I’d suggest using a first-party library instead, something like reaktive: https://github.com/badoo/Reaktive or flow (is it ready yet?)
also see #reaktive
n

Nikita Khlebushkin

10/30/2020, 8:15 PM
The drawback of using Reaktive (if I understood it correctly) is that the library’s methods return types will also be Reaktive types, no?
I just saw this
And it seems to solve all of my problems
Thanks!
s

saket

10/30/2020, 8:16 PM
you can always transform to platform streams
n

Nikita Khlebushkin

10/30/2020, 8:20 PM
Perfect, thanks!
5 Views