title: Passing CGColorRef as a value in KVC/KVO
body: <p>I'm using Opacity to generate all my Quartz2D artwork and I'm now tackling the issue of changing colours via KVC/KVO. Opacity defines all its colour variables as @dynamic and implements its own accessors as part of the class definition.</p>
  
  <p>My question is; how do I pass a new CGColorRef value by key value?</p>
  
  <p>So far (as a testbed) I've got this far:</p>
  
  <pre><code>// Testbed ... Testbed ... Testbed ... Testbed ... Testbed ... Testbed ... Testbed ...
        CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
        CGFloat components[4] = {1.0f, 1.0f, 1.0f, 1.0f};
        CGColorRef color = CGColorCreate(space, components);
  
        [myCALayerReceiverObject setValue: color forKey: @"numColour"];
  // Testbed ... Testbed ... Testbed ... Testbed ... Testbed ... Testbed ... Testbed ...
  </code></pre>
  
  <p>The colour space and creation code is lifted directly from Opacity's CALayer class generator (I'm not that advanced yet) but passing 'color' as the value causes the iPhone simulator to crash and XCode gives me a very cryptic warning;</p>
  
  <p>"Incompatible pointer types sending 'CGColorRef' (aka struct 'CGColor *') to parameter of type 'id' ".</p>
  
  <p>How do I wrap up the CGColorRef to pass it across KVC to the receiver?
  Thanks in advance.</p>