RLMAsymmetricObject

Objective-C

@interface RLMAsymmetricObject : RLMObjectBase

Swift

@_nonSendable(_assumed) class RLMAsymmetricObject : RLMObjectBase

RLMAsymmetricObject is a base class used to define asymmetric Realm objects.

Asymmetric objects can only be created using the createInRealm: function, and cannot be added, removed or queried. When created, asymmetric objects will be synced unidirectionally to the MongoDB database and cannot be accessed locally.

Linking an asymmetric object within an Object is not allowed and will throw an error.

The property types supported on RLMAsymmetricObject are the same as for RLMObject, except for that asymmetric objects can only link to embedded objects, so RLMObject and RLMArray<RLMObject> properties are not supported (RLMEmbeddedObject and RLMArray<RLEmbeddedObject> are).

Creating & Initializing Objects

  • Creates an unmanaged instance of a Realm object.

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Swift

    init()
  • Creates an unmanaged instance of a Realm object.

    Pass in an NSArray or NSDictionary instance to set the values of the object’s properties.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithValue:(nonnull id)value;

    Swift

    convenience init(value: Any)
  • Returns the class name for a Realm object subclass.

    Warning

    Do not override. Realm relies on this method returning the exact class name.

    Declaration

    Objective-C

    + (nonnull NSString *)className;

    Swift

    class func className() -> String

    Return Value

    The class name for the model class.

  • Creates an Asymmetric object, which will be synced unidirectionally and cannot be queried locally.

    Objects created using this method will not be added to the Realm.

    Warning

    This method may only be called during a write transaction.

    Warning

    This method always returns nil.

    Declaration

    Objective-C

    + (nullable instancetype)createInRealm:(nonnull RLMRealm *)realm
                                 withValue:(nonnull id)value;

    Swift

    class func create(in realm: RLMRealm, withValue value: Any) -> Self?

    Parameters

    realm

    The Realm to be used to create the asymmetric object..

    value

    The value used to populate the object.

    Return Value

    Returns nil

Properties