开发者

Is there any way to automatically generate @property and @dynamic tags for Core Data primitive accessors?

Update: mogenerator works, with a template modification

The Core Data documentation suggests using the -primitiveValue and -setPrimitiveValue: methods to access and change internal data of an NSManagedObject subclass rather than the slower and non-type-checked -primitiveValueForKey: and setPrimitiveValue:forKey:.

I would like to adopt this change in my code but in order to avoid compiler warnings I need to add @property 开发者_如何转开发and @dynamic declarations to my managed object classes for all those primitive accessors. Xcode is happy to generate all that code for me, but only for the public accessors to the object (-value rather than -primitiveValue).

Is there any automated method, either through Xcode or an external program that can scan the .xcdatamodel file, to generate those primitive accessors for me so I don't have to type them all out in all 16 of my managed classes?


Have a look at mogenerator (GitHub).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜