One of the main reasons why Rx becomes popular on android is java 7(lack of collections stream api and lambdas). In combination with old retrolambda plugin(desugar task later) Rx brings to java 7 all stream features and a functional programming flavors.
Now we have kotlin which offer a more better functional style with great standard api (streams inclusive). Now kotlin in combination with coroutines and flow api can replace old Rx approaches.
Of course RxJava cannot be replaced fully by kotlin functionality, they have a lot of useful operators like throttle, concatenation, zip, share, combineLatest etc... For complex stream logic RxJava for sure beats kotlin features.
Back to RxBinding... a lot of simple libraries logic now can be replaced by kotlin syntax and here are a few examples:
infix fun <V : View> V.onClick(block: V.() -> Unit) = setOnClickListener { block(it as V) }
myCheckboxView onClick { isChecked = !isChecked }
fun EditText.onTextChange(block: (String) -> Unit) {
this.addTextChangedListener(object: TextWatcher {
override fun afterTextChanged(s: Editable?) { block(s.toString()) }
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
})
}
myEditText.onTextChange(this::printTheText)
But if you need more powerfull api to work with events in a steam then you should choice RxBinding:
myButton.clicks()
.withLatestFrom(myBotton2.clicks(), editText.textChanges().skipInitialValue(), { ... })
.filter { it.locale != null }
.zipWith(detectLocation.text(), { ... })
.doOnNext(::maybeLog)
.subscribe(
this::handleSuccess,
this::handleError
)
RxBindings should not affect UI performance on modern devices https://blog.newrelic.com/technology/android-art-vs-dalvik/. RxJava presumes the usage of a lot anonymous classes and GC will have more job to do and memory leaks in case of issues in your code.