RLM 값

Objective-C

@protocol RLMValue

스위프트

protocol RLMValue

RLMValue는 다형성 Realm 값을 나타내는 속성 유형입니다. 이는 Swift의 AnyObject / Any 사용법과 유사합니다.

 // 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.

다음 유형은 RLMValue를 준수합니다.

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