title: Convert NSArray to Swift Array<T>
body: <p>In CoreData I have defined an <em>ordered</em> to-many relationship. This relationship is defined in Swift like this:</p>
  
  <pre><code>@NSManaged var types : NSMutableArray
  </code></pre>
  
  <p>However, to use Swift at it's best, I want to use a normal Swift array like <code>Type[]</code>. However, CoreData forces me to use <code>NS(Mutable)Array</code>. How can I type-cast / convert the <code>NSArray</code> to <code>Array&lt;Type&gt;[]</code>?</p>
  
  <p>Apparently the confusion arises from the following error:</p>
  
  <pre><code>let array = obj.types as T[] // Cannot convert expression's type 'Node[]' to type '$T2'
  </code></pre>
  
  <p>While this is accepted by the editor:</p>
  
  <pre><code>let array = obj.types as AnyObject[] as T[] // No complaint
  </code></pre>