Created
April 14, 2020 14:04
-
-
Save Nimrodda/a61c313b3b049b6f8a7c8826d7e2fb69 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
sealed class ViewState<T>(val data: T? = null) { | |
class Loading<T>(data: T? = null) : ViewState<T>(data) | |
class Error<T>(val throwable: Throwable, data: T? = null) : ViewState<T>(data) | |
class Loaded<T>(data: T? = null) : ViewState<T>(data) | |
fun isLoading(): Boolean = this is Loading | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment