Swift Code Generation does not create KVC compliant mutation stubs
| Originator: | brianaking | ||
| Number: | rdar://27195876 | Date Originated: | 06-Jul-2016 11:26 AM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 8 beta 2 |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
NSManagedObjects are KVC for the entity as defined in the model file, so methods are generated at runtime if they’re accessed. To expose these methods to the compiler, the obj-c code generation generates stubs like follows:
@interface Event (CoreDataGeneratedAccessors)
- (void)addNotesObject:(Note *)value;
- (void)removeNotesObject:(Note *)value;
- (void)addNotes:(NSSet<Note *> *)values;
- (void)removeNotes:(NSSet<Note *> *)values;
@end
The runtime then provides the implementation. This behavior can be done in swift as well:
extension Event {
@NSManaged func addNotesObject(value: Note)
}
Steps to Reproduce:
Create a managed object entity with a to many relationship and look at the generated code.
Expected Results:
There should be KVC compliant mutation methods stubs generated.
Actual Results:
There are no KVC compliant mutation method stubs generated.
Regression:
This does not appear to be a regression.
Notes:
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!