Observable(LiveData/Rx) Bind Extensions
--
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.
Well, it looks ugly to me. We can do it more readable. RxSwift has bind() function to simply do this operation.
In order to achieve something similar, we can use Extension functions. So I created a file that called ReactiveBindExtensions in our project.
With the help of these extension functions, we can convert our bindings into much readable and clean version. Even cleaner than RxSwift bind() function 🙂
You can find the sample extension code in this gist.
https://gist.github.com/canuludag/d91c5cf40c631271767fc7f593ad6
Thanks for reading ❤️