Skip to content

One Way Bind

paulocns edited this page Mar 14, 2019 · 1 revision

Usage

Inside a LifeCycleOwner to perform a one way bind just call the method bind

bind(queryViewModelArc.searchEnabled, searchButton::setEnabled)
bind(queryViewModelArc.showLoading){ loadinLayout.present = it} 

The bind method is an extension function for LifeCycleOwner and it takes two parameters:

  1. A LiveData of any type
  2. A function that receives one parameter with the same type as the LiveData
Clone this wiki locally