Skip to content

Instantly share code, notes, and snippets.

@harlanhaskins
Last active August 29, 2015 14:26
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 harlanhaskins/8ac341494a7c674c10c1 to your computer and use it in GitHub Desktop.
Save harlanhaskins/8ac341494a7c674c10c1 to your computer and use it in GitHub Desktop.
protocol KindaEquatable {
func ~==(lhs: Self, rhs: Self) -> Bool
}
infix operator ~!= { associativity left precedence 140 }
func ~!=<T where T: KindaEquatable>(lhs: T, rhs: T) -> Bool {
return !(lhs ~== rhs)
}
// MARK: - String
extension String: KindaEquatable {}
infix operator ~== { associativity left precedence 140 }
func ~==(lhs: String, rhs: String) -> Bool {
return lhs.lowercaseString == rhs.lowercaseString
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment