struct ObjectIdentifier
Inheritance |
Comparable, Equatable, Hashable
View Protocol Hierarchy →
|
---|---|
Import | import Swift |
Initializers
Construct an instance that uniquely identifies the metatype x
.
Declaration
init(_ x: Any.Type)
Construct an instance that uniquely identifies the class instance x
.
Declaration
init(_ x: AnyObject)
Instance Variables
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 }
Convert to a UInt
that captures the full value of self
.
Axiom: a.uintValue == b.uintValue
iff a == b
.
Declaration
var uintValue: UInt { get }
A unique identifier for a class instance or metatype. This can be used by reflection clients to recognize cycles in the object graph.
In Swift, only class instances and metatypes have unique identities. There is no notion of identity for structs, enums, functions, or tuples.