Skip to content

Tag Archives: Key-Value Observing

Objective-C 2.0 properties and to-many relationships

I’ve occasionally been asked about the appropriate form for properties representing to-many relationships in Objective-C 2.0. Let’s start with the example of a recipe and its ingredients, represented by instances of the Recipe and Ingredient classes. @interface Recipe : NSObject { @private NSMutableSet *_ingredients; } @property (copy) NSSet *ingredients; @end This is a pretty straightforward […]