Core Data editor does not take optional attributes into account when generating Swift code

Number:rdar://19703082 Date Originated:03-Feb-2015 08:29 PM
Status:Open Resolved:
Product:iOS SDK Product Version:8.1
Classification:Other Bug Reproducible:Always

If an attribute is marked as optional in the Core Data model, the generated Swift code will include it as a regular property. This leads to not being able to check if it is actually nil and can therefore lead to crashes at runtime as every access is treated as a force unwrap.

Steps to Reproduce:

1. Create a an entity with the Core Data editor
2. Add an attribute which is optional
3. Generate code (Swift)

Expected Results:

The attribute should be a Swift optional typed property.

Actual Results:

The attribute will be a regularly typed property.

Regression: -

Notes: -


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!