Last active
November 7, 2019 12:36
-
-
Save prokash-sarkar/f412f339025e0f8c60c41e2bc62c05f6 to your computer and use it in GitHub Desktop.
BaseViewModel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BaseViewModel: ViewModel() | |
{ | |
protected val _viewState: MutableLiveData<ViewState> = MutableLiveData() | |
// don't expose the MutableLiveData outside of the class | |
val viewState: LiveData<ViewState> | |
get() = _viewState // only getter / no setter | |
fun setViewState(viewState: ViewState){ | |
_viewState.value = viewState | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment