Last active
January 12, 2018 19:59
-
-
Save bennokress/4e826e9348b59fa5a4b719bf998c56ed to your computer and use it in GitHub Desktop.
Extensions for Swift's Equatable Protocol
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
extension Equatable { | |
// Usage: 3.isAny(of: 0, 1, 2, 3) // true | |
func isAny(of candidates: Self...) -> Bool { | |
return candidates.contains(self) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment