如何让变数生成器识别Transformable属性的正确类型? [英] How do I get mogenerator to recognize the proper type for Transformable attributes?

查看:153
本文介绍了如何让变数生成器识别Transformable属性的正确类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有单个可变属性的核心数据模型。我也有这个属性使用自定义NSValueTransformer,在模型中正确设置。

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.

当我使用mogenerator生成/更新我的机器和人类文件时,包含此属性的实体的机器文件总是将属性类型指定为NSObject。为了使Core Data使用我的自定义值变换器,此类型需要是转换器理解的类型。现在,我手动做这个人类文件中通过重新定义的属性与正确的类型。这做的工作,使变压器工作。但是,我最终会收到关于属性重新定义的几个编译警告。

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.

推荐答案

这应该更好地记录。

属性类型,在建模器中选择所需的属性,然后切换到用户信息选项卡。然后使用 attributeValueClassName 键创建一个新元素,并创建一个任意值的新元素。

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.

萤幕撷取画面:

这篇关于如何让变数生成器识别Transformable属性的正确类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆