Custom equality in swift objects preserving compatibility with legacy Objective-C code
Yes, you need to override isEqual (and hash) to make your objects fully Objective-C compatible. Here’s a Playground-ready example for the syntax: import Foundation class MyClass: NSObject { var value = 5 override func isEqual(object: AnyObject?) -> Bool { if let object = object as? MyClass { return value == object.value } else { return … Read more