Terminology

In addition to overloading existing terms, key-value coding defines some unique terminology of its own.

Key-value coding can be used to access three different types of object values: attributes, to-one relationships, and to-many relationships. The term property refers to any of these types of values.

An attribute is a property that is a simple value, such as a scalar, string, or Boolean value. Value objects such as NSNumber and other immutable types such as as NSColor are also considered attributes.

A property that specifies a to-one relationship is an object that has properties of its own. These underlying properties can change without the object itself changing. For example, an NSView instance’s superview is a to-one relationship.

Finally, a property that specifies a to-many relationship consists of a collection of related objects. An instance of NSArray or NSSet is commonly used to hold such a collection. However, key-value coding allows you to use custom classes for collections and still access them as if they were an NSArray or NSSet by implementing the key-value coding accessors discussed in “Collection Accessor Patterns for To-Many Properties.”