title: How do I correctly check for a successful downcast to AnyObject?
body: <p>I'm working with something trivialized to this:</p>
  
  <pre><code>func isAnyObject&lt;T&gt;(someObject: T) {
      if let object = someObject as? AnyObject {
          // do something
      } else {
          // do something else
      }
  }
  </code></pre>
  
  <p>Which gives me the compiler warnings: </p>
  
  <ol>
  <li>Conditional cast from 'T' to 'AnyObject' always succeeds </li>
  <li>Non-optional expression of type  'AnyObject' used in a check for
  optionals</li>
  </ol>
  
  <p>I understand why the cast always succeeds, but I don't know what to do to fix it. I tried changing line 2 to 
  <code>if let object = foo as AnyObject?</code>
  but when I pass a struct through the function, it still gets into the 'if' block. What am I missing here?</p>