Last active
February 8, 2020 11:56
-
-
Save sanogueralorenzo/03707bd493bbcdbbf8b38cfc81a64ecd 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
fun <T> MutableLiveData<Resource<T>>.setSuccess(data: T? = null) = | |
postValue(Resource(ResourceState.SUCCESS, data)) | |
fun <T> MutableLiveData<Resource<T>>.setLoading() = | |
postValue(Resource(ResourceState.LOADING, value?.data)) | |
fun <T> MutableLiveData<Resource<T>>.setError(message: String? = null) = | |
postValue(Resource(ResourceState.ERROR, value?.data, message)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment