trello-archive/RxLifecycle

Casting LifecycleTransformer to Transformer

Closed this issue · 3 comments

I recently upgraded RxLifecycle in my project from 1.0 to 4.0.2.. One of the things that broke was this.. I was passing a Transformer into compose but with new changes, bindUntilEvent returns a LifeCycleTransformer..

I think I can cast it to Transformer but don't know how.. Or am I missing something else here?

My code snippet:
.compose(bindUntilEvent(ActivityEvent.PAUSE))

Error message:
Required type: Transformer <? super Void, ? extends R>
Provided: LifecycleTransformer <Object,

reason: no instance(s) of type variable(s) T exist so that LifecycleTransformer conforms to Transformer<? super Void, ? extends R>

@dlew after investigating this issue a bit more, I have found that the latest version of RxLifecycle depends on RxJava3 but I'm using RxJava1 which is likely why my compose method is expecting a Transformer.. I just wanted to double check this with you.. that in order to use the latest version of RxLifecycle, my project should also use RxJava3 - is that correct?

dlew commented

Yes, the different major versions of RxLifecycle are tied to different versions of RxJava. In particular, RxLifecycle 1 == RxJava 1, RxLifecycle 2 == RxJava 2, and RxLifecyle 4 == RxJava 3. (RxLifecycle 3 had to do with AndroidX, another major dependency.)