Leaving out either one of the above will result in a mapping that assumes camelCase for your properties which map to snake_case for the JSON equivalents.
As you can do with Mantle, you can specify NSValueTransformers for your properties:
Realm requires that you use different RLMRealm objects when working across different threads. This means you shouldn't access the same RLMObject instances from different threads. To make this easier to work with, use - primaryKeyValue to retrieve the wrapped primary key value from an instance and query for it later using + objectInRealm:withPrimaryKeyValue:.
id primaryKeyValue = [episode primaryKeyValue];
dispatch_async(dispatch_get_main_queue(), ^{
MCEpisode *episode = [MCEpisode objectInRealm:[RLMRealm defaultRealm] withPrimaryKeyValue:primaryKeyValue];
// do something with episode here
});
Working with (temporary) copies (RLMObject+Copying)
If you need to display UI that may or may not change an object's properties, it is sometimes useful to work with an object not bound to a realm as a backing model object. When it is time to commit changes, the properties can be copied back to the stored model.
Methods - shallowCopy and - mergePropertiesFromObject: are provided. The later of which needs to be performed in a realm transaction.
请发表评论