Safe KVC macro by Andrew Pouliot. In the public domain.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
|//o is an object type, k is the key on which to check validity|
|//returns a NSString constant of the relevant key|
|#define KVC(o, k) (0 && sizeof(o.k) ? @#k : @#k)|
|ObjectWithMethodCalledKeyName *object = ...;|
|[object addObserver:self forKeyPath:KVC(object, keyName) options:0 context:NULL];|