RLMThreadConfined

@protocol RLMThreadConfined <NSObject>

Objects of types which conform to RLMThreadConfined can be managed by a Realm, which will make them bound to a thread-specific RLMRealm instance. Managed objects must be explicitly exported and imported to be passed between threads.

Managed instances of objects conforming to this protocol can be converted to a thread-safe reference for transport between threads by passing to the +[RLMThreadSafeReference referenceWithThreadConfined:] constructor.

Note that only types defined by Realm can meaningfully conform to this protocol, and defining new classes which attempt to conform to it will not make them work with RLMThreadSafeReference.

  • The Realm which manages the object, or nil if the object is unmanaged.

    Unmanaged objects are not confined to a thread and cannot be passed to methods expecting a RLMThreadConfined object.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) RLMRealm *realm;

    Swift

    var realm: RLMRealm? { get }
  • Indicates if the object can no longer be accessed because it is now invalid.

    Declaration

    Objective-C

    @property (nonatomic, readonly, getter=isInvalidated) BOOL invalidated;

    Swift

    var isInvalidated: Bool { get }