Skip to content

Instantly share code, notes, and snippets.

@yannickl
Last active October 20, 2015 17:56
Show Gist options
  • Save yannickl/ef5c59f07836b2ac320e to your computer and use it in GitHub Desktop.
Save yannickl/ef5c59f07836b2ac320e to your computer and use it in GitHub Desktop.
Behavior change between Debug and Release modes with XCode7 and Swift2
enum MyEnum {
case Foo
case Bar(param: Int)
case Baz
func isFoo() -> Bool {
if case .Foo = self {
return true
}
return false
}
func isBaz() -> Bool {
if case .Baz = self {
return true
}
return false
}
}
let a: MyEnum = .Baz
print(a.isFoo()) // "false" in debug mode, "true" in release mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment