title: Execute a function before the orientation change
body: <p>When the orientation changes, is it possible to execute a function and wait for it until it finish executing and then perform the rotation? Something like that:</p>
  
  <pre><code>override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
          super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
  
           doStuff()
  
          // block until doStuff is done
          weak var weakSelf = self
          coordinator.animateAlongsideTransition({ (UIViewControllerTransitionCoordinatorContext) -&gt; Void in
  
              }, completion: { (UIViewControllerTransitionCoordinatorContext) -&gt; Void in  
  
          })
      }
  </code></pre>