ThreadSafeReference

An object intended to be passed between threads containing a thread-safe reference to its thread-confined object.

To resolve a thread-safe reference on a target Realm on a different thread, pass to Realm.resolve(_:).

Warning

A ThreadSafeReference object must be resolved at most once. Failing to resolve a ThreadSafeReference will result in the source version of the Realm being pinned until the reference is deallocated.

Note

Prefer short-lived ThreadSafeReferences as the data for the version of the source Realm will be retained until all references have been resolved or deallocated.

  • Indicates if the reference can no longer be resolved because an attempt to resolve it has already occurred. References can only be resolved once.

  • Create a thread-safe reference to the thread-confined object.

    Note

    You may continue to use and access the thread-confined object after passing it to this constructor.