Skip to content

Instantly share code, notes, and snippets.

@sanogueralorenzo
Last active November 6, 2018 13:08
Show Gist options
  • Save sanogueralorenzo/d693a2bace731582f9d6b50c80140c32 to your computer and use it in GitHub Desktop.
Save sanogueralorenzo/d693a2bace731582f9d6b50c80140c32 to your computer and use it in GitHub Desktop.
class UserListViewModel : ViewModel() {
val users = MutableLiveData<Resource<List<User>>>()
private fun loading() = users.setLoading()
private fun success(userList: List<User>) = users.setSuccess(userList)
private fun error(throwable: Throwable) = users.setError(throwable.message)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment