Skip to content

Instantly share code, notes, and snippets.

@AniketSK
Created August 28, 2020 11:32
Show Gist options
  • Save AniketSK/6fa22c8d0ff523217f271783191a2b5f to your computer and use it in GitHub Desktop.
Save AniketSK/6fa22c8d0ff523217f271783191a2b5f to your computer and use it in GitHub Desktop.
A way to define a generic kotlin lce.
sealed class Lce<T> {
class Loading<T> : Lce<T>() // Can't be an object since it wouldn't have the T otherwise.
data class Content<T>(val data : T) : Lce<T>()
data class Error<T>(val error : Throwable) : Lce<T>()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment