Skip to content

Instantly share code, notes, and snippets.

@meschbach
Last active August 16, 2016 16:38
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 meschbach/1f0f793176af712230803997f46b843b to your computer and use it in GitHub Desktop.
Save meschbach/1f0f793176af712230803997f46b843b to your computer and use it in GitHub Desktop.
Swift Enumeration Matching
enum SomeEnum {
case .ExampleValue
case .CountedCase( someCount : Int )
}
func doSomething( state : SomeEnum ){
switch state {
case ExampleValue:
print("Example")
case CountedCase( 0 ):
print("0")
case let CountedCase( count ):
print("Count \(count)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment