Impossible to Specify Enum Type for Core Data Code Generation

Originator:rileytestut
Number:rdar://27693956 Date Originated:04-Aug-2016 01:18 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 8
Classification:Other Bug Reproducible:Always
 
Summary:
When using the new Core Data Code Generation, it is possible to specify a “transformable” attribute with a custom class. However, because it is limited to Objective-C classes, you cannot specify a custom enum type, which is especially annoying when using the generated code from Swift.

Steps to Reproduce:
1) Add a transformable attribute to a Core Data entity

Expected Results:
There is an option to specify the type of the transformable attribute.

Actual Results:
There’s only an option to specify the _class_ of the transformable attribute, not any type.

Regression:
n/a

Notes:
There is no clean workaround for this issue. You could name the attribute in the model editor something different, and then declare a “public” accessor that is typed as an enum, but then both the public accessor and the generated “private” attribute are accessible. You can technically put any type you want in the “Custom Class” box, but unfortunately due to a previous bug I reported (rdar://27512940), it is always marked as a Swift optional, and Objective-C doesn’t support optional value types so it won’t compile.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!