ObjectKeyIdentifable

public protocol ObjectKeyIdentifable : Object, Identifiable

A protocol which defines a default identity for Realm Objects

Declaraing your Object subclass as conforming to this protocol will supply a default implemention for Identifiable‘s id which works for Realm Objects:

// Automatically conforms to `Identifiable`
class MyObjectType: Object, ObjectKeyIdentifiable {
    // ...
}

You can also manually conform to Identifiable if you wish, but note that using the object’s memory address does not work for managed objects.

  • id Default implementation

    The stable identity of the entity associated with self.

    Default Implementation

    A stable identifier for this object. For managed Realm objects, this value will be the same for all object instances which refer to the same object (i.e. for which Object.isSameObject(as:) returns true).

    Declaration

    Swift

    var id: UInt64 { get }