Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are CoreDataGeneratedAccessors?

When I created a CoreData object with a one-to-many relationships, I get some methods (CoreDataGeneratedAccessors). Do we need to implement these methods? The methods generated automatically are given below :

- (void)addCirqitsObject:(Cirqit *)value;
- (void)removeCirqitsObject:(Cirqit *)value;
- (void)addCirqits:(NSSet *)value;
- (void)removeCirqits:(NSSet *)value;
like image 899
Joel Mathew Avatar asked Jul 19 '13 06:07

Joel Mathew


1 Answers

You do not have to implement those methods, but you can. In the case you don't, CoreData will generate them dynamically for you.

If you want overwrite the default implementation please read the Core Data Programming Guide (Custom To-Many Relationship Accessor Methods) to find a sample implementation.

A reason to overwrite might be to trigger additional calculations or updates before or after new Cirqit objects being added or removed. But be aware of not to change the sample implementation code, just add your custom code - otherwise you might break your relationships handling.

like image 185
Florian Mielke Avatar answered Oct 09 '22 05:10

Florian Mielke