title: Read NSArray of CGPoints in Swift
body: <p>I have a function in an Objective-C class that returns an NSArray:</p>
  
  <pre><code>- (NSArray *) myAwesomeFunction {
     // Good stuff here
     return array
  }
  </code></pre>
  
  <p>Now I know that the members of this array are all <code>NSValue</code> objects with a <code>CGPoint</code> inside. This information is not available to Swift however, which infers the return type (correctly) as <code>[AnyObject]!</code></p>
  
  <p>Now when I try to cast the members of the array into an <code>NSValue</code> I get a cast error as I should.</p>
  
  <pre><code>let myArray = AnObjectiveCClass.myAwesomeFunction()
  let myValue = myArray[0] as NSValue // Cast error since AnyObject cannot be cast to NSValue
  </code></pre>
  
  <p>This leaves me with a problem though, how can I access the contents of the array in my Swift class? In the end I want to retrieve the CGPoint values inside of the array.</p>