Skip to content

Instantly share code, notes, and snippets.

@vodamiro
Created April 11, 2019 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vodamiro/36ad3771a04fb591a012c135e0909c13 to your computer and use it in GitHub Desktop.
Save vodamiro/36ad3771a04fb591a012c135e0909c13 to your computer and use it in GitHub Desktop.
S_A_SealedClasses2.kt
fun handleStateChange(newState: UIState) {
when (newState) {
is LoadingState -> println("Loading ...")
is DataState -> println("Got data: ${newState.data}")
is ErrorState -> println("Error: ${newState.error.message}")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment