Pierrick
09/28/2017, 10:11 AMVariable
to access to the current value (myVar.value
) and if you want you can create an observable (myVar.toObservable
). There is a way to do that with RxKotlin ?gildor
09/28/2017, 10:16 AMgildor
09/28/2017, 10:17 AMedwardwongtl
09/28/2017, 10:53 AMBehaviorSubject.createDefault(myVar)
RxJava does not have such thing as Variable
, the similar thing should be BehaviorSubject
Pierrick
09/28/2017, 11:12 AMedwardwongtl
09/28/2017, 11:24 AMVariable
does not exist in RxJava/Kotlin, but BehaaviorSubject
just lacks the ability to replay the initial value?
I can't think of any case that you need the initial value when you have a more updated value...Pierrick
09/28/2017, 11:49 AMBehaaviorSubject
.
But Variable
is useful in some case because :
- You can't emit error.
- You don't use onNext.
- You set directly the value property.
- Automatically complete when it’s about to be deallocated.
I can do the job with the BehaviourSubject.
Thank you for your help !