title: Switching on a generic type?
body: <p>Is it possible to switch on a generic type in Swift?</p>
  
  <p>Here's an example of what I mean:</p>
  
  <pre><code>func doSomething&lt;T&gt;(type: T.Type) {
      switch type {
      case String.Type:
          // Do something
          break;
      case Int.Type:
          // Do something
          break;
      default:
          // Do something
          break;
      }
  }
  </code></pre>
  
  <p>When trying to use the code above, I get the following errors:</p>
  
  <pre class="lang-none prettyprint-override"><code>Binary operator '~=' cannot be applied to operands of type 'String.Type.Type' and 'T.Type'
  Binary operator '~=' cannot be applied to operands of type 'Int.Type.Type' and 'T.Type'
  </code></pre>
  
  <p>Is there a way to switch on a type, or to achieve something similar? (calling a method with a generic and performing different actions depending on the type of the generic)</p>