RLMObject with Array of NSStrings
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.
The implementation of an Array for a RLMObject is to use an RLMArray where T inherits RLMObject
I could make an object that inherits.. property inside which is string… but that seems like quite some overhead to replace an NSArray of strings.
Does anyone know the recommended best practice to do this?
Solutions Collect From Internet About “RLMObject with Array of NSStrings”
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
- Download and execute iOS code dynamically at runtime
- How to integrate Chartboost IOS SDK with Swift
- What API can be used to hide OSX Dock when you drag a window towards it
- libsqlite3.dylib and libz.dylib missing in Xcode 7. How do I use Parse?
- Is there any way to “wait here…” in code – just like an empty loop?
- How to Share an Image to facebook?
- Dropbox SDK 401 Error
- Cocos2d font : How to create .fnt file for CCLabelBMFont? ( Any free bitmap font creation tool ? )
- How to make a map-like view that has a custom map image?
- How to print a NSRange in NSLog
- Safe way to render UIVIew to an image on background thread?
- Objective-C ParseKit return value
- NSURLConnection delegate method
- Swift does not conform to protocol
- How to track the device location (iOS and Android) device using Phonegap