Last active
October 28, 2020 08:57
-
-
Save raulh82vlc/da0c029c12194e774b9c2b4330f25a4e to your computer and use it in GitHub Desktop.
TweetsListUIUtils.kt extension function toolkit
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
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