title: Swift: animateWithDuration behavior
body: <p>I have made simple animation of text and buttons to came from out of the screen to middle of the screen, but it doesn't. It goes from screen, to out of the screen. Basically, animation is reversed.</p>
  
  <p>I have seen that other apps works the way I wont with same code, so I do not know what is wrong. :(</p>
  
  <p>Here is the code:</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
  @IBOutlet weak var welcomeText: UILabel!
  @IBOutlet weak var worksText: UILabel!
  @IBOutlet weak var loginButton: UIButton!
  @IBOutlet weak var signUp: UIButton!
  @IBOutlet weak var socialLog: UILabel!
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
  }
  
  override func viewWillAppear(animated: Bool) {
  
      welcomeText.alpha = 0.0
      worksText.alpha = 0.0
      loginButton.alpha = 0.0
      signUp.alpha = 0.0
      socialLog.alpha = 0.0
  
      welcomeText.center.x -= view.bounds.width
      worksText.center.x -= view.bounds.width
      socialLog.center.x -= view.bounds.width
      signUp.center.x -= view.bounds.width
  }
  
  override func viewDidAppear(animated: Bool) {
  
      self.welcomeText.fadeIn()
      UIView.animateWithDuration(0.7, delay: 0.1, options: .CurveEaseOut, animations: {
          self.welcomeText.center.x += self.view.bounds.width
          self.view.layoutIfNeeded()
          }, completion: nil)
  
      self.worksText.fadeIn()
      UIView.animateWithDuration(0.7, delay: 0.5, options: .CurveEaseOut, animations: {
          self.worksText.center.x += self.view.bounds.width
          self.view.layoutIfNeeded()
          }, completion: nil)
  
      self.socialLog.fadeIn()
      UIView.animateWithDuration(0.7, delay: 0.3, options: .CurveEaseOut, animations: {
          self.socialLog.center.x += self.view.bounds.width
          self.view.layoutIfNeeded()
          }, completion: nil)
  
      self.signUp.fadeIn()
      UIView.animateWithDuration(0.7, delay: 0.7, options: .CurveEaseOut, animations: {
          self.signUp.center.x += self.view.bounds.width
          self.signUp.alpha = 0.5
          self.view.layoutIfNeeded()
          }, completion: nil)
  }
  }
  
  extension UIView {
  func fadeIn(duration: NSTimeInterval = 0.5, delay: NSTimeInterval = 0.0, completion: ((Bool) -&gt; Void) = {(finished: Bool) -&gt; Void in}) {
      UIView.animateWithDuration(duration, delay: delay, options: UIViewAnimationOptions.CurveEaseIn, animations: {
          self.alpha = 1.0
          }, completion: completion)  }
  
  func fadeOut(duration: NSTimeInterval = 0.5, delay: NSTimeInterval = 0.0, completion: (Bool) -&gt; Void = {(finished: Bool) -&gt; Void in}) {
      UIView.animateWithDuration(duration, delay: delay, options: UIViewAnimationOptions.CurveEaseIn, animations: {
          self.alpha = 0.0
          }, completion: completion)
  }
  }
  </code></pre>