The FooBar
class below has to override the ==
function of the Equatable
type.
However, calling contains
on an array of FooBar
objects does not cause a breakpoint inside the custom ==
function to get invoked. Is it possible another ==
function is overriding this custom one?
Note: Because FooBar must subclass from NSCoding and NSObject, FooBar does not list Equatable as a protocol because it causes this error:
Redundant conformance of 'FooBar' to protocol 'Equatable'
func ==(lhs: FooBar, rhs: FooBar) -> Bool {
return lhs.id == rhs.id
}
class FooBar: NSObject, NSCoding {
// Class def
}
// Both serverFooBars and gFooBars are [FooBar]
let newFooBars = serverFooBars.filter { !gFooBars.contains($0) }