Simple Value Expressions in a Core Data Mapping Model?
Simple Value Expressions in a Core Data Mapping Model?
- Subject: Simple Value Expressions in a Core Data Mapping Model?
- From: Jerry Krinock <email@hidden>
- Date: Fri, 04 Jan 2013 15:28:31 -0800
I needed to create a Core Data Mapping Model today. The only value migration necessary was to negate a boolean. It seems like one should be able to enter such a simple expression into the "Value Expression" column of "Attribute Mappings". Reading the Predicate Programming Guide, I tried, in turn, these three…
!$source.foo
NOT $source.foo
NOT($source.foo)
However, in each case, Xcode complained of an invalid expression. At that point I gave up and did the only thing I know that works, which is to subclass NSMigrationPolicy, implement a method that negates a given NSNumber, and reference it in the expression…
FUNCTION($entityPolicy, "negateBoolean:" , $source.foo)
It tested OK and is ready to ship. But, for next time, is there an easier way to do this?
Thanks,
Jerry
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden