Skip to content

Instantly share code, notes, and snippets.

@gastsail
Created November 15, 2019 17:41
Show Gist options
  • Save gastsail/dadb9d1bfbeb2bdee0c2ec2b54a41d2f to your computer and use it in GitHub Desktop.
Save gastsail/dadb9d1bfbeb2bdee0c2ec2b54a41d2f to your computer and use it in GitHub Desktop.
MainViewModel
class MainViewModel(private val useCase: UserUseCase) : ViewModel() {
fun retrieveUserData(userId:String):LiveData<Resource<String>> {
val userData = MutableLiveData<Resource<String>>()
useCase.retrieveUserData(userId).observeForever {
userData.postValue(it)
}
return userData
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment