title: Run two animations simultaneously
body: <p>I'm trying to create an animation with two views and I've encountered some unexpected behaviors while performing them.</p>
  
  <p>I want to animate both views position while doing a second animation which is <code>transitionFlipFromBottom</code></p>
  
  <p>Here's the code:</p>
  
  <pre><code>let initialFrame = CGRect(x: xpos, y: -310, width: 300, height: 300)
  
  let firstView = UIView()
  firstView.backgroundColor = .red
  firstView.frame = initialFrame
  
  let secondView = UIView()
  secondView.backgroundColor = .white
  secondView.frame = initialFrame
  secondView.isHidden = false
  
  
  self.view.addSubview(firstView)
  self.view.addSubview(secondView)
  
  
  // Here I try to move the views on screen while fliping them
  UIView.animate(withDuration: 1, delay: 0, options: .curveEaseOut, animations: {
      secondView.center = self.view.center
      firstView.center = self.view.center
      self.flip(firstView: firstView, secondView: secondView)
  }, completion: nil)
  
  
  
  // This function flips the views vertically while it animates the transition from the first to the second view
  fileprivate func flip(firstView: UIView, secondView: UIView) {
      let transitionOptions: UIViewAnimationOptions = [.transitionFlipFromBottom, .showHideTransitionViews]
      UIView.transition(with: firstView, duration: 0.5, options: transitionOptions, animations: {
          firstView.isHidden = true
      })
  
      UIView.transition(with: secondView, duration: 0.5, options: transitionOptions, animations: {
          secondView.isHidden = false
      })
  }
  </code></pre>
  
  <p>The code above fails to execute both animations at the same time.</p>
  
  <p>It only works if I place the <code>flip</code> function call inside the <code>completion</code> block, after the first animation (moving frame) finishes, as the following:</p>
  
  <pre><code>UIView.animate(withDuration: 1, delay: 0, options: .curveEaseOut, animations: {
      secondView.center = self.view.center
      firstView.center = self.view.center
  }, completion: {(_) in
      self.flip(firstView: dummyView, secondView: newGroupView)
  })
  </code></pre>
  
  <p>I have even tried to use <code>UIView.animateKeyframes</code> but it still doesn't work.</p>
  
  <p>Am I missing something here? </p>
  
  <p>Thank you.</p>