protocol Hashable Instances of conforming types provide an integer hashValue and can be used as Dictionary keys. Inheritance Equatable View Protocol Hierarchy → Import import Swift Instance Variables var hashValue: Int Required The hash value. Axiom: x == y implies x.hashValue == y.hashValue. Note: The hash value is not guaranteed to be stable across different invocations of the same program. Do not persist the hash value across program runs. Declaration var hashValue: Int { get } Instance Methods func ==(_:rhs:) Required Returns true if lhs is equal to rhs. Equality implies substitutability. When x == y, x and y are interchangeable in any code that only depends on their values. Class instance identity as distinguished by triple-equals === is notably not part of an instance's value. Exposing other non-value aspects of Equatable types is discouraged, and any that are exposed should be explicitly pointed out in documentation. Equality is an equivalence relation x == x is true x == y implies y == x x == y and y == z implies x == z Inequality is the inverse of equality, i.e. !(x == y) iff x != y. Declaration func ==(lhs: Self, rhs: Self) -> Bool Declared In Equatable