Hello. I am really, really unsure on how to access...
# multiplatform
Hello. I am really, really unsure on how to access the badoo.reaktive
from my native Android app . I have the following:
Copy code
fun getAssignedBooks(): SingleWrapper<List<String>> {
    return singleFromCoroutine {
But when I try to do this:
Copy code
val assignedBooks = SharedBookRepository().getAssignedBooks()
I get this:
Cannot access 'com.badoo.reaktive.base.Source' which is a supertype of 'com.badoo.reaktive.single.SingleWrapper'. Check your module classpath for missing or conflicting dependencies
Cannot access 'com.badoo.reaktive.single.Single' which is a supertype of 'com.badoo.reaktive.single.SingleWrapper'. Check your module classpath for missing or conflicting dependencies
Any ideas why ? 😞 I'm using RxJava2 in my native Android app, I'd also like to chain the
with other observables and singles using
and such, but not sure how I can do that. And it's been stressing me out for the past hour+
Most likely you need to either add Reaktive as an
dependency to your Android app module, or make Reaktive
dependency in your shared module.
For interop with RxJava2, Reaktive provides
module which you can use in your Android app module -
implementation "com.badoo.reaktive:rxjava2-interop:<version>
Regarding rxjava2-interop ... how would I go about doing that? I failed to find a proper doc in that regard ... 😞 And if I convert to an rxjava Single, i won't be able to use the same method in Swift then, no? I need it to be a SingleWrapper for swift ... Or am i missing something ?
RxJava is only required if you need to perform conversions RxJava<-> Reaktive. Some use cases are: 1. You have a Reaktive Observable exposed from your shared module, and you need to pass it to a method that accepts RxJava Observable. This could be an existing RxJava-based code on the Android side. 2. Your shared module accepts Reaktive Observable, but you have an RxJava Observable in the Android app. You can check what extension functions are available - https://github.com/badoo/Reaktive/tree/master/rxjava2-interop/src/main/kotlin/com/badoo/reaktive/rxjavainterop E.g.
If you don't have any existing RxJava code, then most likely you can use Reaktive if it would be RxJava. E.g. apply operators, subscribe, etc.
ok, so simply changing from
in my shared module's build.gradle ... made it work. It seems i'm missing some basic understanding of gradle but why did api work instead of implementation? 😑
It tells Gradle to expose the library from your module, so it can be used by consuming modules. Useful when consuming modules would have to add the library anyway.
That is a wonderful piece of knowledge I should have known already. Thank you very, very much for that ! I never used it before. :)