Skip to content

Instantly share code, notes, and snippets.

@GuilhE
Created June 23, 2021 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GuilhE/c0b4c3ff9dc843e9d21b03c837a5949a to your computer and use it in GitHub Desktop.
Save GuilhE/c0b4c3ff9dc843e9d21b03c837a5949a to your computer and use it in GitHub Desktop.
Medium article - KMM
//void example
sealed class ReservationResult<out T : Any> : ManagerResult<T, Throwable>() {
object Success : ReservationResult<Unit>()
data class Error(override val exception: Throwable) : ReservationResult<Nothing>()
}
//value example
sealed class ReservationListResult<out T : Any> : ManagerResult<T, Throwable>() {
data class Success(override val data: List<Event>) : ReservationListResult<List<Event>>()
data class Error(override val exception: Throwable) : ReservationListResult<Nothing>()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment