Skip to content

Instantly share code, notes, and snippets.

@veritech
Created December 8, 2016 00:19
Show Gist options
  • Save veritech/7c6f8f5aa6b59fa218dc234ebf0675b2 to your computer and use it in GitHub Desktop.
Save veritech/7c6f8f5aa6b59fa218dc234ebf0675b2 to your computer and use it in GitHub Desktop.
Blogpost code
class Object: NSObject {
let name:String
init(name:String) {
self.name = name
}
}
func ==(lhs: Object, rhs:Object) -> Bool {
return lhs.name == rhs.name
}
func doSomethingWhenTheStringMatches() {
print("hello word")
}
let a = Object(name: "foo")
let b = Object(name: "foo")
if a == b {
doSomethingWhenTheStringMatches()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment