Skip to content

Instantly share code, notes, and snippets.

@lordcodes
Created February 3, 2020 09:43
Show Gist options
  • Select an option

  • Save lordcodes/4bf1645714e249381331368776a9ee77 to your computer and use it in GitHub Desktop.

Select an option

Save lordcodes/4bf1645714e249381331368776a9ee77 to your computer and use it in GitHub Desktop.
Code for article: "The power of sealed classes in Kotlin"
fun renderViewState(viewState: ViewState) = when (viewState) {
LoadingState -> showLoadingViews()
is PresentingState -> showPresentingViews(viewState.viewData)
is ErrorState -> showErrorViews(viewState.message)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment