Files
swift-mirror/stdlib/public/SDK/ObjectiveC
Karoy Lorentey d03786ee1c [ObjectiveC] NSObject: Clarify hashing implementation
NSObject defines its own interface for hashing and equality. Subclasses must implement custom hashing by overriding the hash property, or NSSet and NSDictionary will not work correctly.

Unfortunately, we currently define NSObject.hashValue and NSObject.hash(into:) as overridable, which leads people to accidentally override one of these instead of hash. hashValue is explicitly declared open, while hash(into:) is automatically synthesized as such.

Making hashValue non-open is a potentially source breaking change, but we can at least provide an explicit, non-overridable definition for hash(into:), and update the documentation to explain the contract.
2018-07-26 16:09:54 +01:00
..