Skip to content

Instantly share code, notes, and snippets.

@Aidanvii7
Last active Jan 15, 2019
Embed
What would you like to do?
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