RLMObject with Array of NSStrings

后端 未结 1 944
太阳男子
太阳男子 2021-01-11 17:22

I\'ve been upgrading a project to use Realm as the persistence store and I\'m not able to find any documentation on how to use an array of strings in one of my models.

相关标签:
1条回答
  • 2021-01-11 18:02

    As of Realm Cocoa 3.0 you can simply do RLMArray<RLMString> *array; and no longer need the wrapper object type.


    In older versions of Realm you need an RLMObject which contains the string:

    @interface StringObject : RLMObject
    @property NSString *value;
    @end
    RLM_ARRAY_TYPE(StringObject)
    
    @implementation StringObject
    @end
    
    @interface Object : RLMObject
    @property RLMArray<StringObject> *array;
    @end
    
    0 讨论(0)
提交回复
热议问题