title: Adding observer for KVO without pointers using Swift
body: <p>In Objective-C, I would normally use something like this:</p>
  
  <pre><code>static NSString *kViewTransformChanged = @"view transform changed";
  // or
  static const void *kViewTransformChanged = &amp;kViewTransformChanged;
  
  [clearContentView addObserver:self
                         forKeyPath:@"transform"
                            options:NSKeyValueObservingOptionNew
                            context:&amp;kViewTransformChanged];
  </code></pre>
  
  <p>I have two overloaded methods to choose from to add an observer for KVO with the only difference being the context argument:</p>
  
  <pre><code> clearContentView.addObserver(observer: NSObject?, forKeyPath: String?, options: NSKeyValueObservingOptions, context: CMutableVoidPointer)
   clearContentView.addObserver(observer: NSObject?, forKeyPath: String?, options: NSKeyValueObservingOptions, kvoContext: KVOContext)
  </code></pre>
  
  <p>With Swift not using pointers, I'm not sure how to dereference a pointer to use the first method.</p>
  
  <p>If I create my own KVOContext constant for use with the second method, I wind up with it asking for this:</p>
  
  <pre><code>let test:KVOContext = KVOContext.fromVoidContext(context: CMutableVoidPointer)
  </code></pre>
  
  <p>EDIT: What is the difference between CMutableVoidPointer and KVOContext? Can someone give me an example how how to use them both and when I would use one over the other?</p>
  
  <p>EDIT #2: A dev at Apple just posted this to the forums: KVOContext is going away; using a global reference as your context is the way to go right now.</p>