I have a class that I’d rather not have based off of NSObject, but I do want to
have identity based equality. I’ve done that as follows:
class Foobar { }
extension Foobar:Equatable { }
func == (a:Foobar, b:Foobar) -> Bool {
return a === b
}
What’s less clear to me is how to go about implementing an identity based hash
extension Foobar:Hashable {
var hashValue:Int {
// what magic should happen here?
}
}
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users