From 471ec3fb124f36a54a088fd2dfbf6f347fabae08 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Wed, 16 Mar 2022 17:41:01 +0200 Subject: [PATCH] Fixed annoying WeakDictionary warning.. the right way .. I think. --- .../Other/WeakDictionary/WeakDictionaryKeyReference.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Other/WeakDictionary/WeakDictionaryKeyReference.swift b/ElementX/Sources/Other/WeakDictionary/WeakDictionaryKeyReference.swift index 6d74e6a41..3fcfa539b 100644 --- a/ElementX/Sources/Other/WeakDictionary/WeakDictionaryKeyReference.swift +++ b/ElementX/Sources/Other/WeakDictionary/WeakDictionaryKeyReference.swift @@ -26,8 +26,12 @@ public struct WeakDictionaryKey : 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? {