Skip to content

Instantly share code, notes, and snippets.

@LewisRhine
Created November 21, 2016 21:05
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 LewisRhine/f19c5af27049ac6432be695c24fffd64 to your computer and use it in GitHub Desktop.
Save LewisRhine/f19c5af27049ac6432be695c24fffd64 to your computer and use it in GitHub Desktop.
Example Nearby Restaurant State Tree
sealed class RestaurantNearby() {
sealed class Loading() : RestaurantNearby() {
//Code for getting Location, and API call
sealed class Done() : Loading() {
fun reloadData() {}
class Ready(val restaurants: List<Restaurant>) : Done()
class Empty() : Done()
class Error(val message: String, val throwable: Throwable?) : Done()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment