Key Value Coding (KVC) is one of the cornerstones of Cocoa Bindings. KVC allows us to access the attributes of an object without calling the accessors of that object directly. Key Value Coding is implemented through an informal protocol on NSObject itself and is used mainly through the getter/setter pair valueForKey(:) and setValue(:forKey:).
The method valueForKey(:) is a generic accessor that retrieves an attribute on an object. For example, if we had an object called Recipe and it had an attribute called name, normally we’d access that attribute via the following:
|||let myRecipe = ...|
|||let recipeName = myRecipe.name|
However, this requires specific knowledge about the Recipe object to exist in the calling ...