Last active
August 29, 2015 14:17
-
-
Save hartbit/8a0a0e031b8c82cb3167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Enum : Equatable { | |
case Case1 | |
case Case2(variable: AnyObject) | |
} | |
let a = Enum.Case1 | |
let b = a == Enum.Case1 | |
func == (e1: Enum, e2: Enum) -> Bool { | |
switch e1 { | |
case .Delete: | |
switch e2 { | |
case .Delete: | |
return true | |
case .Insert: | |
return false | |
} | |
case .Insert(let elem1): | |
switch e2 { | |
case .Delete: | |
return false | |
case .Insert(let elem2): | |
return elem1 == elem2 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment