In order for a class to be considered KVC compliant for a specific property, it must implement the methods required for valueForKey: and setValue:forKey: to work for that property.
For properties that are an attribute or a to-one relationship, this requires that:
Your class implements a method named -<key>, -is<Key>, or has an instance variable <key> or _<key>.
If the property is mutable, then it should also implement -set<Key>:.
Your implementation of the -set<Key>: method should not perform validation.
Your class should implement -validate<Key>:error: if validation is appropriate for the key.
For to-many relationships, KVC compliance requires that:
Your class implements a method named -<key> that returns an array, has an array instance variable named <key> or _<key>, or implements the methods -countOf<Key> and -objectIn<Key>AtIndex:. Optionally, you can also implement -get<Key>:range: to improve performance.
If the to-many related objects are mutable, and the -<key> method does not return an NSMutableArray, you must also implement -insertObject:in<Key>AtIndex: and -removeObjectFrom<Key>AtIndex:. Optionally, you can also implement -replaceObjectIn<Key>AtIndex:withObject: to improve performance.
Last updated: 2007-06-06