How does a custom accessor method implementation in Core Data look like?
- by dontWatchMyProfile
The documentation is pretty confusing on this one:
The implementation of accessor methods
you write for subclasses of
NSManagedObject is typically different
from those you write for other
classes.
If you do not provide custom instance
variables, you retrieve property
values from and save values into the
internal store using primitive
accessor methods. You must ensure that
you invoke the relevant access and
change notification methods
(willAccessValueForKey:,
didAccessValueForKey:,
willChangeValueForKey:,
didChangeValueForKey:,
willChangeValueForKey:withSetMutation:usingObjects:,
and
didChangeValueForKey:withSetMutation:usingObjects:).
NSManagedObject disables automatic
key-value observing (KVO, see
Key-Value Observing Programming Guide)
change notifications, and the
primitive accessor methods do not
invoke the access and change
notification methods.
In accessor methods for properties
that are not defined in the entity
model, you can either enable automatic
change notifications or invoke the
appropriate change notification
methods.
Are there any examples that show how these look like?