One of the nicer features surrounding Objective-C are Key Value Observation (KVO) and Key Value Coding. KVO provides a mechanism to observe changes in a property on an object. Key Value Coding is an informal protocol — which NSObject implements — that gives you the ability to query an object and its properties.
There are times when an object wants to observe changes in a property of another object and mirror those changes in a property of its own. Unfortunately, implementing this behavior requires a verbose set of KVO code that has to be duplicated between objects that want to have this behavior.
Having to do this on more than one occasion led me to create a library called Key Path Bindings that simplifies and reduces the complexity of binding properties to a key path on another object.
With Key Path Bindings:
Using the magic of MAZeroingWeakRef () we can further reduce the complexity by removing the need to unbind the property in the
Key Path Bindings creates custom subclasses on observed objects in order to generate KVO and dealloc code. Which means it does not currently play nice with objects that have already been subjected to KVO. KVO performs its own runtime trickery that makes subclassing that kind of object relatively complex (See here and here).
If you want to dive into the code you can see it here.