NSKey informal protocol defines a mechanism by which you can access the properties of an object indirectly by name (or key), rather than directly through invocation of an accessor method or as instance variables. Thus, all of an object’s properties can be accessed in a consistent manner.
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
The basic methods for accessing an object’s values are
set, which sets the value for the property identified by the specified key, and
value(for, which returns the value for the property identified by the specified key. The default implementation uses the accessor methods normally implemented by objects (or to access instance variables directly if need be).