Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created September 8, 2023 08:46
Show Gist options
  • Save laevandus/e81a8a55710cfd1abaf2ade294e8c48a to your computer and use it in GitHub Desktop.
Save laevandus/e81a8a55710cfd1abaf2ade294e8c48a to your computer and use it in GitHub Desktop.
enum State {
case loading
case error(Error)
case view
}
func logState() {
switch state {
case .loading:
print("Showing loading view")
case .error: // or case .error(_):
print("Showing error view")
case .view:
print("Showing content view")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment