RLMObject with Array of NSStrings

后端 未结 1 958
太阳男子
太阳男子 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 *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 *array;
    @end
    

    0 讨论(0)
提交回复
热议问题