Skip to content

Instantly share code, notes, and snippets.

@raulh82vlc
Last active October 28, 2020 08:57
Show Gist options
  • Save raulh82vlc/da0c029c12194e774b9c2b4330f25a4e to your computer and use it in GitHub Desktop.
Save raulh82vlc/da0c029c12194e774b9c2b4330f25a4e to your computer and use it in GitHub Desktop.
TweetsListUIUtils.kt extension function toolkit
fun TweetsListUI.handleStates(stateFlow: TweetsUIState?) {
when (stateFlow) {
is TweetsUIState.LoadingUIState -> {
showLoading()
}
is TweetsUIState.ListResultsUIState -> {
showResults(stateFlow)
}
is TweetsUIState.EmptyUIState -> {
showEmptyState()
}
is TweetsUIState.ErrorUIState -> {
showError(stateFlow)
} else -> {
showEmptyState()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment