core-datatransformationmogeneratortransformable

How do I get mogenerator to recognize the proper type for Transformable attributes?


I have a Core Data model with a single transformable attribute. I also have this attribute use a custom NSValueTransformer, setup in the model properly.

When I use mogenerator to generate/update my machine and human files, the machine files for the entity containing this attribute always type the attribute to NSObject. In order for Core Data to use my custom value transformer, this type needs to be the type the transformer understands. Right now, I manually do this in the human file by redefining the property with the proper type. This does the job and gets the transformer working. However, I end up with several compile warnings regarding redefinition of the attribute.

One of the more recent releases of mogenerator specified in the release notes that transformable attributes are now supported. However, I haven't found any example syntax to enable this feature.


Solution

  • This should be better documented.

    To set your generated attributes's type, select your desired attribute in the modeler and switch to the User Info tab. Then create a new element with a key of attributeValueClassName and a value of whatever you'd like.

    Here's a screenshot:

    mogenerator screen shot