title: Swift check type against a generic type
body: <p>I've a generic function with 1 parameter and want to check the type of the passed parameter with the generic type. Something like this:</p>
  
  <pre><code>func generic&lt;T&gt;(parameter: AnyObject) -&gt; Bool {
      if parameter is T {
          return true
      } else {
          return false
      }
  }
  </code></pre>
  
  <p>But I don't know how to call this </p>
  
  <pre><code>generic&lt;String&gt;("Hello")
  </code></pre>
  
  <p>Gives me a compiler error: "Cannot explicitly specialize a generic function
  generic("Hello")</p>