Created
January 8, 2021 10:04
-
-
Save haifengkao/79e93181705451b82e15ddefc0e0c104 to your computer and use it in GitHub Desktop.
TaggedWeakWillCrashIfPutToEnum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TaggedWeak<T: AnyObject, Hash: Hashable>: Hashable { | |
public static func == (lhs: TaggedWeak<T, Hash>, rhs: TaggedWeak<T, Hash>) -> Bool { | |
lhs.hash == rhs.hash | |
} | |
public func hash(into hasher: inout Hasher) { | |
hasher.combine(hash) | |
} | |
public weak var value: T? | |
let hash: Hash | |
public init(hash: Hash, _ value: T?) { | |
self.value = value | |
self.hash = hash | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment