Last active
June 14, 2018 10:51
-
-
Save marcinOz/0c5f1018e66fbc603c4fe4b47e7d2379 to your computer and use it in GitHub Desktop.
Kotlin ViewModel AAC
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 MovieListViewModel @Inject constructor(private val dataProvider: DataProvider) : ViewModel() { | |
val movieDiscover = MutableLiveData<List<Movie>>() | |
fun fetchMovieDiscover() { | |
dataProvider.getMovieDiscover().subscribeBy( | |
onSuccess = { result -> movieDiscover.postValue(result) | |
}, | |
onError = { error -> movieDiscover.postValue(null) } | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment