This document describes the
NSKeyValueCoding informal protocol, which defines a mechanism allowing applications to access the properties of an object indirectly by name (or key), rather than directly through invocation of an accessor method or as instance variables.
You should read this document to gain an understanding of how to use key-value coding in your applications and how to make your classes key-value coding compliant for interacting with other technologies. Key-value coding is a key technology when working with key-value observing, Cocoa bindings, Core Data, and making your application AppleScript-able. You are expected to be familiar with the basics of Cocoa development and the Objective-C language.
Organization of This Document
Key-Value Coding includes these articles:
“What Is Key-Value Coding?” provides an overview of key-value coding.
“Terminology” defines the terms commonly used to refer to an object’s properties.
“Key-Value Coding Fundamentals” describes the basic principles required to use key-value coding.
“Key-Value Coding Accessor Methods” describes the accessor methods your classes should implement.
“Key-Value Validation” tells you how to implement property validation.
“Ensuring KVC Compliance” describes the capabilities a class must implement to be key-value coding compliant.
“Scalar and Structure Support” describes the data types supported by key-value coding.
“Collection Operators” lists the available collection operators and describes their use.
“Accessor Search Implementation Details” explains how the appropriate accessor method or instance variable is determined.
“Describing Property Relationships” describes the use of meta-data to define the relationships between objects and their properties.
“Performance Considerations” describes the performance considerations when using key-value coding.
There are other technologies, not covered in this document, that are related to key-value coding.
Key-Value Observing Programming Guide describes the features of the key-value observing protocol that allows objects to observe changes in other objects.
© 2003, 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-07-17)