title: Checking if object is not of type in swift
body: <p>I need to check if an object is not of a certain type. I know in Kotlin it's possible to check if a type is not by using <code>!is</code>. I was wondering if there was an equivalent in Swift, or a workaround I could use if it's not possible?</p>
  
  <p>Example in Kotlin:</p>
  
  <p>Assume animals is an interface of different animals and there are classes that implement it such as <code>Cat</code>, <code>Dog</code>, <code>Horse</code>, <code>Spider</code>, etc:</p>
  
  <pre><code>var animals = listOf&lt;Animals&gt;(Horse(), Cat(), Dog(), Spider())
  var chosenAnimals = animals.filter { it !is Spider }
  </code></pre>