Ah, I see what you’re getting at. This is interesting.

Previously when I’ve wanted to implement things like this I’ve used 
Transformable attributes, which provide an automatic packing/unpacking feature 
using a packing/unpacking class that I specify in the data model. It is 
necessary to be careful how one handles making sure the object is marked dirty 
appropriately, but that’s not too hard.

In my case, I’m thinking of using this approach to map a data BLOB (stored as 
an NSDate object in CD) to a mutable dictionary. The dictionary keys would 
depend on which enumeration value is associated with the event.

Cheers,

Rick

On Jul 6, 2015, at 6:29 PM, Quincey Morris 
<quinceymor...@rivergatesoftware.com<mailto:quinceymor...@rivergatesoftware.com>>
 wrote:

On Jul 6, 2015, at 16:21 , Rick Aurbach 
<r...@aurbach.com<mailto:r...@aurbach.com>> wrote:

Are you suggesting that we implement a custom fetched property

No, I’m thinking of this:

https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/CoreData/Articles/cdNSAttributes.html#//apple_ref/doc/uid/TP40001919-SW13

under the heading “Scalar Value”, but some of the details are here:

https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/CoreData/Articles/cdAccessorMethods.html#//apple_ref/doc/uid/TP40002154-SW1

The idea is that you create non-primitive accessors that have a type that’s not 
known to Core Data. You back it with a Core Data property, using any convenient 
mechanism. Optionally, you can have an instance variable that caches the non-CD 
value, or you can just convert it back and forth on the fly.

Note that you can, of course, back your customized property with multiple CD 
properties, or with a CD property whose value themselves have sub-properties.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to