Reputation: 3147
I am not very experienced with recent Core Data so please bear with me if I am missing important points here.
When conforming to NSCoding an NSObject didn't need to have it's own implementation of NSValueTransformer / ValueTransformer. You would describe it as Transformable in the Xcode model editor without defining a Value Transformer and the object would still persist as you would expect with the help of a NSValueTransfomer.
Now, Codable entered stage to replace NSCoding. The question is: does it already or will it give me the same convenience NSCoding gave me by not needing to implement a custom ValueTransformer?
Upvotes: 0
Views: 525
Reputation: 70936
Core Data doesn't know anything about Codable
, so conforming to Codable
makes no difference to how Core Data works. It would be really nice if what you described worked, and I suggest you file an enhancement request with Apple about it. I've already done so (rdar://37708071 in case anyone from Apple reads this), and the more people who ask, the more likely they'll add this.
For now, your options are:
NSCoding
and a transformable attribute.Codable
but then convert to/from Data
yourself outside of Core Data, and use a binary attribute.Upvotes: 1