Last active
January 15, 2019 15:40
-
-
Save Aidanvii7/818dbc037ab8ca72a3287a12734a0c2f to your computer and use it in GitHub Desktop.
This file contains 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 : ViewModel() { | |
@get:MainThread | |
val users: LiveData<List<String>> by unsafeLazy { | |
MutableLiveData<List<String>>().apply { loadUsersInto(this) } | |
} | |
private fun loadUsersInto(liveData: MutableLiveData<List<String>>) { | |
// do async operation to fetch users and update | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment