Core Data ValueTransformer Options

off-topic

(Jeremy Saklad) #1

This is my first topic on the forums, so I’m not sure if this is the right place for it. Please tell me if it is not.

When creating a Core Data model with Xcode, entity attributes can be specified as Transformable. That allows you to use any type capable of being transformed to and from the Data type using NSValueTransformer.

In many cases, it is preferable to store values as one of the explicitly supported types, such as String or Int64. This allows you to use more sophisticated queries.

Since NSValueTransformer can ostensibly be used to convert between any two types, is it possible to have Transformable attributes stored as, say, Int64? This would be especially helpful for raw enumerations.