Core Data fails to generate KVO to-many accessors in Swift Managed Object Subclasses

Originator:jesse.d.squires
Number:rdar://22302320 Date Originated:16 Aug 2015
Status:Open Resolved:
Product:Developer Tools Product Version:7.0 beta 5 (7A176x)
Classification:Serious Bug Reproducible:Always
 
Summary:
In Swift, generating Managed Object subclasses with to-many relationships fails to generate KVO-compliant to-many accessors.


From Xcode 7 beta 5 release notes:

The NSManaged attribute can now be used with methods as well as properties, for access to Core Data’s automatically-generated Key-Value-Coding-compliant to-many accessors.


@NSManaged var employees: NSSet
 


@NSManaged func addEmployeesObject(employee: Employee)
 @NSManaged func removeEmployeesObject(employee: Employee)
 @NSManaged func addEmployees(employees: NSSet)

@NSManaged func removeEmployees(employees: NSSet)


These can be declared in your NSManagedObject subclass. (17583057)

Steps to Reproduce:
0. Use Swift
1. Create a Core Data iOS app
2. Add models with to-many relationships
3. Generate the Managed Object subclasses
4. Note that the to-many accessors are NOT generated for you by Xcode
5. Cry yourself to sleep

Expected Results:
Xcode should generate the to-many accessors for you in Swift.

Actual Results:
Xcode does not generate the to-many accessors for you.

Version:
Version 7.0 beta 5 (7A176x)

Notes:


Configuration:


Attachments:

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!