title: How to switch on class type in Swift?
body: <p>I have the following code:</p>
  
  <pre><code>class Base {}
  class A: Base {}
  class B: Base {}
  class C: Base {}
  
  func next(obj: Base) -&gt; Base {
      if obj is A { return B() }
      else if obj is B { return C() }
      else if obj is C { return A() }
      else { return A() }
  }
  </code></pre>
  
  <p>How do I express the chained <code>if</code>s as a single <code>switch</code> statement instead?</p>