Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hrules6872
Created June 26, 2018 22:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrules6872/99b007c498c919404f9961715ecbe5a7 to your computer and use it in GitHub Desktop.
Save hrules6872/99b007c498c919404f9961715ecbe5a7 to your computer and use it in GitHub Desktop.
fun showState(state: State) {
when (state) {
State.Loading -> println("loading")
is State.Content -> println("list size: ${state.list.size}")
is State.Error -> println("error: ${state.errorCode}")
State.Empty -> println("empty")
}.exhaustive
}
val Any?.exhaustive: Unit
get() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment