Created
October 20, 2018 03:29
-
-
Save timusus/76db5e439346cae1466815c8973efba5 to your computer and use it in GitHub Desktop.
Sealed result Retrofit enqueue snippet
This file contains 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
call.enqueue { | |
override fun onResult(result: Result) { | |
when(result){ | |
is Success -> { | |
// Handle Success | |
} | |
is Failure -> { | |
// Handle failure | |
result.error.doSomething() | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment