Created
December 8, 2016 00:19
-
-
Save veritech/7c6f8f5aa6b59fa218dc234ebf0675b2 to your computer and use it in GitHub Desktop.
Blogpost code
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
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