title: Swift: Pass Type as Parameter
body: <p>Is it possible to pass in a Type as a function parameter in Swift?  Note: I do not want to pass in an object of the specified type, but instead the Type itself.  For example, if I wanted to replicate Swift's <code>as?</code> functionality:</p>
  
  <pre><code>infix operator &lt;-? { associativity left }
  func &lt;-? &lt;U,T&gt;(x:U?, t:T) -&gt; T? {
    if let z = x as? t {
        return z
      }
    }
  }
  </code></pre>
  
  <p>Of course, <code>t</code> is being pass in as a type, but I would like to pass in the Type itself so I can check against that type in the function body.</p>