title: How to check two instances are the same class/type in swift
body: <p>I know that I can check the type of a var in Swift with <code>is</code></p>
  
  <pre><code>if item is Movie {
      movieCount += 1
  } else if item is Song {
      songCount += 1
  }
  </code></pre>
  
  <p>but how can I check that two instances have the same class? The following does not work:</p>
  
  <pre><code>if item1 is item2.dynamicType {
      print("Same subclass")
  } else {
      print("Different subclass)
  }
  </code></pre>
  
  <p>I could easily add a "class" function and update it in each subclass to return something unique, but that seems like a kludge...</p>