Created
February 19, 2020 14:41
-
-
Save fluxtah/e7cb5f277caa0fefa0845b84fcbeb878 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 MyViewModel : BaseViewModel() { | |
val data: LiveData<String> = MutableLiveData() | |
fun load() { | |
data.forceValue("Hello, World") | |
} | |
private fun <T> LiveData<T>.forceValue(value: T) { | |
(this as MutableLiveData<T>).value = value | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment