title: In Swift, how do I animate a UIView with auto-layout like a page sliding in?
body: <p>I try to create a UIView that is representing a page whose size is the same as the device screen. Since the app supports orientation, I am using AutoLayout to construct it. </p>
  
  <p>It works fine until I try to animate the page to slide in from the right. Here is the best I could come up with after some research:</p>
  
  <pre><code>myView = UIView()
  myView.backgroundColor = UIColor.orangeColor()
  parentView.addSubview(myView)
  
  myView.translatesAutoresizingMaskIntoConstraints = false
  myView.leftAnchor.constraintEqualToAnchor(parentView.rightAnchor).active = true
  myView.widthAnchor.constraintEqualToAnchor(parentView.widthAnchor).active = true
  myView.heightAnchor.constraintEqualToAnchor(parentView.heightAnchor).active = true
  
  UIView.animateWithDuration(Double(1.0), animations: {
      self.myView.leftAnchor.constraintEqualToAnchor(self.parentView.leftAnchor).active = true
      self.myView.layoutIfNeeded()
  })
  </code></pre>
  
  <p>With the code above, the page <code>myView</code> slides in from the top-left corner, which is not what I am expecting and the log also says <code>Unable to simultaneously satisfy constraints</code>.</p>
  
  <p>Any advise to help me and correct me for better understanding AutoLayout and animation is very much appreciated. Thanks.</p>