title: Swift - Array with specific class type
body: <p>How can i create array which will hold objects belonging a specific class.</p>
  
  <pre><code>class BaseObject {}
  
  class Derived1: BaseObject {}
  class Derived2: BaseObject {}
  class Derived2: BaseObject {}
  </code></pre>
  
  <p>I need to create array in which will hold only Object derived from <code>BaseObject</code> </p>
  
  <p>Something like - <code>var array : [BaseObject.Type] = []</code></p>
  
  <p>Is there a way to specify this ? </p>
  
  <p>Also, I should be able to use it something like this</p>
  
  <pre><code>if let derived1 = object as? [Derived1] {
  
  }
  else if let derived2 = object as? [Derived2] {
  
  }
  </code></pre>