title: How to ensure protocol conformance at runtime?
body: <pre><code>@interface Dog : NSObject
  @end
  
  @implementation Dog
  - (id)valueForUndefinedKey:(NSString *)key
  {
      if ([key isEqualToString:@"quacks"])
          return YES;
  }
  @end
  </code></pre>
  
  <p>The above allows to leverage KVC and write something like :</p>
  
  <p><code>[[Dog new] valueForKey:@"quacks"]; // YES</code></p>
  
  <p>However, can the objc runtime be used to leverage the same KVC mechanism, AND conform to the Duck protocol at runtime ?</p>
  
  <pre><code>@protocol Duck &lt;NSObject&gt;
  @optional
    @property (readonly) BOOL quacks;
  @end
  
  id&lt;Duck&gt; dug = (id&lt;Duck&gt;)[Dog new];
  dug.quacks; // YES
  </code></pre>