Last active
November 11, 2019 09:08
-
-
Save herisulistiyanto/077e679209a6f22eb7ef67c0507ce60c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class DashboardViewModel(private val movieRemoteDataSource: MovieRemoteDataSource) : ViewModel() { | |
private val _movieResult = MutableLiveData<ResponseResult<ResponseWrapper<MovieResponse>>>() | |
val movieResult: LiveData<ResponseResult<ResponseWrapper<MovieResponse>>> get() = _movieResult | |
fun discoverAllMovies() { | |
viewModelScope.launch { | |
val response = movieRemoteDataSource.discoverAllMovies(it) | |
//usually i do like this, but it will give null when we observe movieResult | |
_movieResult.value = response.value | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment