title: Swift: Conditional type casting (as?, as!) in if let statements
body: <p>What is the recommended approach for using 'as' in combination with 'if' if there are multiple possibilities for the base class, e.g.</p>
  
  <pre><code>var delegate:AnyObject?
  
  func myFunction(){
  
  if let delegate = self.delegate as? A1ViewController {
    delegate.callFunction()
  }
  
  if let delegate = self.delegate as? A2ViewController{
     delegate.callFunction()
  }
  }
  </code></pre>
  
  <p>Is there a way to combine the two if statements above?</p>
  
  <p>e.g. </p>
  
  <pre><code>if let delegate = self.delegate as? A1ViewController || let delegate = self.delegate = self.delegate as? A2ViewController {
     delegate.callFunction()
  }
  </code></pre>