title: How to check that object of type `Any` is an array of concrete class implementing some protocol
body: <p>I have faced an issue.
  Consider I have one protocol and two classes implementing it:</p>
  
  <pre><code>protocol Initiatable{
      init()
  }
  
  class A: Initiatable{
      required init() {}
  }
  
  class B: Initiatable{
      required init() {}
  }
  </code></pre>
  
  <p>then at some point I'm creating an array and passing it to function:</p>
  
  <pre><code>var array = [A]()
  
  func update(object: Any){
  
  }
  
  update(object: array)
  </code></pre>
  
  <p>from that function <code>update</code> I would like to pass <code>object</code> to another function if it mets another function's conditions:</p>
  
  <pre><code>func process&lt;T: Initiatable&gt;(array: T){
      /* ... */
  }
  </code></pre>
  
  <p>So how can I check that object of type <code>Any</code> is an array of concrete class implementing <code>Initiatable</code> protocol? I would like to write something like</p>
  
  <pre><code>func update(object: Any){
      if let array = object as Array&lt;T: Initiatable&gt;{
          process(array: array)
      }
  }
  </code></pre>
  
  <p>But that's doesn't work. Code like:</p>
  
  <pre><code>func update(object: Any){
      if let array = object as [Initiatable]{
          process(array: array)
      }
  }
  
  func process(array: [Initiatable]){ }
  </code></pre>
  
  <p>Compiles fine, but that's not what I want – <code>process</code> function should receive an array of concrete implementation of <code>Initiatable</code> so at some point it could use:</p>
  
  <pre><code>func process&lt;T: Initiatable&gt;(array: [T]){
      /* other code */
      T.init()
  }
  </code></pre>
  
  <p>So is there any way to do this? Thank you very much in advance!</p>