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'
-
Obsoleto(a)
Em vez disso, use
rlm_anyValueType
, que também inclui tipos de coleçãoDescreve o tipo de propriedade armazenada.
Declaração
Objective-C
@property (readonly) RLMAnyValueType rlm_valueType;
Swift
var rlm_valueType: RLMAnyValueType { get }
-
Descreve o tipo de propriedade armazenada.
Declaração
Objective-C
@property (readonly) RLMAnyValueType rlm_anyValueType;
Swift
var rlm_anyValueType: RLMAnyValueType { get }