Core Data class generation doesn't respect optional properties in Swift

Originator:jesse.d.squires
Number:rdar://21098402 Date Originated:25 May 2015
Status:Open Resolved:
Product:Xcode Product Version:6.3.2 (6D2105)
Classification:Serious bug Reproducible:Always
 
Summary:
When generating an NSManagedObject subclass in Swift for an entity in Core Data, if a an attribute is marked as optional then its corresponding property should be generated as an optional. That is, "Type?" instead of "Type"

Steps to Reproduce:
1. Create an entity in Core Data with optional attributes
2. Generate NSManagedObject subclass
3. Note that property is not optional

Expected Results:
For example, Xcode should generate this:

class TestEntity: NSManagedObject {

    @NSManaged var myString: String? // optional in core data

}

Actual Results:
Instead, Xcode generates this:

class TestEntity: NSManagedObject {

    @NSManaged var myString: String // optional in core data

}

Version:
Version 6.3.2 (6D2105)

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!