Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class MyActivity: Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setupViewModel()
}
private fun setupViewModel() {
viewModel = //factory fancy way to get the instance of ViewModel
viewModel.viewState.observe(this, Observer {
when (it) {
MVIViewState.Loading -> { // show loading
}
MVIViewState.Error -> { // display error message
}
MVIViewState.Success -> { // show data fetched
}
}
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.