Fixed annoying WeakDictionary warning.. the right way .. I think.

This commit is contained in:
Stefan Ceriu
2022-03-16 17:41:01 +02:00
parent 36aa097bb1
commit 471ec3fb12

View File

@@ -26,8 +26,12 @@ public struct WeakDictionaryKey<Key: AnyObject & Hashable, Value: AnyObject> : H
|| lhs.hashValue == rhs.hashValue
}
public var hashValue: Int {
return baseKey != nil ? hash : nilKeyHash
public func hash(into hasher: inout Hasher) {
if baseKey == nil {
hasher.combine(nilKeyHash)
} else {
hasher.combine(baseKey)
}
}
public var key: Key? {