Last active
November 6, 2018 11:22
-
-
Save Runman44/0a26c477ad37c64de9e2df726e256746 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
enum class ScreenState { | |
LOADING, | |
ERROR, | |
SUCCESS | |
} | |
class Response(val state: ScreenState, val data: String?, val error: Throwable?) | |
fun main(args: Array<String>) { | |
val response = Response(ScreenState.SUCCESS, "yay", null) | |
when (response.state) { | |
ScreenState.SUCCESS -> doStuff(response.data!!) | |
ScreenState.LOADING -> { } | |
ScreenState.ERROR -> { } | |
} | |
} | |
fun doStuff(data: String) { | |
//NO-OP | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment