Last active
December 21, 2015 23:11
-
-
Save superlopuh/9d461cfa2d6748cbaa11 to your computer and use it in GitHub Desktop.
Example of matching for any value in array.
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
let myString: String? = nil | |
func ~=<T: Equatable>(values: [T?], value: T?) -> Bool { | |
return values.contains({$0 == value}) | |
} | |
if [nil, ""] ~= myString { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment