RLMValue

Objective-C

@protocol RLMValue

Swift

protocol RLMValue

RLMValue é um tipo de propriedade que representa um valor de Realm polimórfico. Isso é semelhante ao uso de AnyObject / Any no Swift.

 // A property on `MyObject`
 @property (nonatomic) id<RLMValue> myAnyValue;

 // A property on `AnotherObject`
 @property (nonatomic) id<RLMValue> myAnyValue;

 MyObject *myObject = [MyObject createInRealm:realm withValue:@[]];
 myObject.myAnyValue = @1234; // underlying type is NSNumber.
 myObject.myAnyValue = @"hello"; // underlying type is NSString.
 AnotherObject *anotherObject = [AnotherObject createInRealm:realm withValue:@[]];
 myObject.myAnyValue = anotherObject; // underlying type is RLMObject.

Os seguintes tipos estão em conformidade com RLMValue:

NSData NSDate NSNull NSNumber NSUUID NSString RLMObject RLMObjectId RLMDecimal128 RLMDictionary RLMArray NSArray NSDictionary'