I have read the iOS-related chapters of Marcus S. Zarra's Core Data: Data Storage and Management for iOS, OS X, and iCloud (2nd edition) to great benefit. I am wondering about one aspect, though, where the book suggests a style that is different from my own.
The book's examples access NSManagedObject
s' attributes and relationships by utilizing KVC (e.g. [recipe valueForKey: @"name"]
). There are (only) two brief explanations of how one could go about defining property accessors (e.g. for use in recipe.name
). This seems to imply a clear recommendation of KVC in favor of property accessors.
I generally like property accessors, e.g. because they guard against bugs caused by typos (e.g. [recipe valueForKey: @"nam"]
) and because Xcode can generate their source code for me (Editor
| Create NSManagedObject Subclass
).
My question is this: are there technical reasons for why one should use KVC instead of property-accessor style in general?