title: Swift generic type cast
body: <p>I have a generic class where I have an array of generic types. No I want to do some operations based on the class in the array. I have 2 classes: Person and House (no Inheritance). But this code doesn't work:</p>
  
  <pre><code>let allValues = [T]()
  if allValues[0] is Person { 
       let values = (allValues as [Person])
  }
  </code></pre>
  
  <p>But this doesn't work as <em>T is not identical to 'Person'</em>. What do I have to do? Thanks for any help.</p>