title: What does `self.view.layoutIfNeeded()` do when changing constraints
body: <p>So I'm learning how to make views animate from out of screen, to use as slider-menus.</p>
  
  <pre><code>class ViewController: UIViewController {
      @IBOutlet weak var red: UIView!
      @IBOutlet weak var redHConstraint: NSLayoutConstraint!
  
      @IBAction func buttonShift(sender: AnyObject) {
          self.view.layoutIfNeeded()        // **HERE**
          UIView.animateWithDuration(0.5) {
              self.redHConstraint.constant = 0
              self.view.layoutIfNeeded()    // And **HERE**
          }
      }
  
  }
  </code></pre>
  
  <p>i've adapted this code from <a href="https://stackoverflow.com/questions/27371935/how-to-animate-a-uiview-with-constraints-in-swift">How to animate a UIView with constraints in Swift?</a></p>
  
  <p><strong>1. What does <code>self.view.layoutIfNeeded()</code> part of the code do?</strong></p>
  
  <p><strong>2. Why is it coded 2x, before and during animation?</strong></p>
  
  <p>Note: if i comment-out the 1st <code>self.view.layoutIfNeeded()</code> nothing changes, but if i comment-out the 2nd <code>self.view.layoutIfNeeded()</code> the movement is no longer animated and just appears in the new coordinates.</p>