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
- Detect file in use by other process
- Swift: why I can't call method from override init?
- How to add hours to an NSDate?
- Annotation along route in MapKit
- Check duplicate property values of objects in NSArray
- Multiple Targets in Xcode: “Failed to launch simulated application: Unknown error.”
- iOS – best practice for managing code merge in a storyboard
- Pragma to explicitly enable ARC?
- -webkit-animation-play-state not working on iOS 8.1 (probably lower too)
- UINavigationBar frame height returns 44.0 but is actually 64.0
- com.apple.CoreData.SQLDebug not working
- Xcode 4.2 + c++0x/libc++ cannot find iostream
- How to link to Update page for our app
- Displaying multiple NSFetchedResultsControllers in different sections of same UITableView
- programmatically prevent app from running in background iOS