Created
April 14, 2020 21:43
-
-
Save EudyContreras/c23259ae8ecfbe7326a8b93730d83a1b 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 Resource<out T>( | |
open val data: T?, | |
open val loading: Boolean | |
) { | |
class Success<T>( | |
data: T | |
) : Resource<T>( | |
data = data, | |
loading = false | |
) | |
class Loading<T>( | |
cache: T? = null | |
) : Resource<T>( | |
data = cache, | |
loading = true | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment