Skip to content

Instantly share code, notes, and snippets.

@minsOne
Last active September 26, 2023 11:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minsOne/90a26e25ea1816a2aa1c02703f690b24 to your computer and use it in GitHub Desktop.
Save minsOne/90a26e25ea1816a2aa1c02703f690b24 to your computer and use it in GitHub Desktop.
SwiftUI DataState
enum DataState<V, E: Error> {
case idle
case initialLoading case reLoading (V)
case retryLoading (E)
case success (V)
case failure(E)
case paging (V)
case pagingFailure(V, E)
}
@State private var dataState: DataState< [Post], any Error> = idle