Observable(LiveData/Rx) Bind Extensions

Can Uludağ
2 min readApr 12, 2020


Often times I find myself observing simple values from LiveData or Rx observables and setting them to view items like TextViews or EditTexts. Or setting visibility of a Button or TextView.

Post values in ViewModel
Observe values in MainActivity

Well, it looks ugly to me. We can do it more readable. RxSwift has bind() function to simply do this operation.

It binds ViewModel value to Label or Image Field

In order to achieve something similar, we can use Extension functions. So I created a file that called ReactiveBindExtensions in our project.

Here are some of the functions

With the help of these extension functions, we can convert our bindings into much readable and clean version. Even cleaner than RxSwift bind() function 🙂

Makes binding much readable

You can find the sample extension code in this gist.


Thanks for reading ❤️

Ask me on Twitter, Instagram or Linkedin



Can Uludağ

Mobile developer | Former Co-Founder @ Peakode | Coffee geek | Street photography lover | https://uludagcan.com/me/