title: Find item of specific type in array
body: <p>I want an extension on a Array where you can find an item that is of some type.</p>
  
  <p>I tried like this:</p>
  
  <pre><code>  func findItem&lt;U: Type&gt;(itemToFind: U) -&gt; AnyObject? {
      for item in self {
          if let obj = item as? itemToFind {
              return obj
          }
      }
      return nil
  }
  </code></pre>
  
  <p>So I check if it is the same type and then I want to return the obj. </p>
  
  <p>The error I get is:</p>
  
  <blockquote>
    <p>Inheritance from non-protocol, non-class 'Type'.</p>
  </blockquote>
  
  <p>How can I fix this that I can pass to the function <code>ViewController.self</code> and that I get back nil if not found or the viewcontroller that is in the array?</p>