Nizzle94
09/15/2018, 11:00 AMKirill Rozhenkov
09/16/2018, 5:33 PMfun <D : Any, T : LiveData<D>> T.observeWith(owner: LifecycleOwner, receiver: (D) -> Unit) {
observe(owner, Observer<D> {
if (it != null) {
receiver(it)
}
})
}
and then you can call this function in your code like this: loginViewModel.progress().observeWith(this, this::onProgress)
Nizzle94
09/17/2018, 6:22 AM