Skip to content

Instantly share code, notes, and snippets.

@inso-
Created July 7, 2020 14:58
Show Gist options
  • Save inso-/7c6af8104001ae7820047315185786c5 to your computer and use it in GitHub Desktop.
Save inso-/7c6af8104001ae7820047315185786c5 to your computer and use it in GitHub Desktop.
Hashable extension to Weak property wrapper
extension Weak: Hashable {
public static func == (lhs: Weak<Wrapped>, rhs: Weak<Wrapped>) -> Bool {
lhs.hashValue == rhs.hashValue
}
public func hash(into hasher: inout Hasher) {
hasher.combine(unsafeBitCast(value, to: Int.self))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment