title: (Swift) Fade-In and Out a Label
body: <p>I'm trying to fade a label in and out when it appears on the screen. Currently, I'm simply hiding it using </p>
  
  <pre><code>button.hidden = true
  </code></pre>
  
  <p>and unhiding it by using false. I would like to animate this process with a fade-in and out as it looks much smoother this way. Appreciate the help !</p>
  
  <p>Here is the code I'm using which gets an error.  <a href="http://imgur.com/a/HI4eg" rel="nofollow">http://imgur.com/a/HI4eg</a></p>
  
  <pre><code>class ViewController: UIViewController {
  @IBOutlet weak var yeah: UILabel!
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      UIView.animateWithDuration(1.0, delay: 0.0, options: .CurveEaseOut, animations: {
          self.yeah.alpha = 0.0
          }, completion: {
              (finished: Bool) -&gt; Void in
  
              //Once the label is completely invisible, set the text and fade it back in
              self.yeah.text = "your Text "
  
              // Fade in
              UIView.animateWithDuration(1.0, delay: 0.0, options: .CurveEaseIn, animations: {
                  self.yeah.alpha = 1.0
                  }, completion: {
                      (finished: Bool) -&gt; Void in
  
                      //Once the label is completely invisible, set the text and fade it back in
                      self.yeah.text = "your Text "
  
                      // Fade in
                      UIView.animateWithDuration(1.0, delay: 0.0, options: .CurveEaseIn, animations: {
                          self.yeah.alpha = 1.0
                          }, completion:nil )
  
  
  
  
              })
      // Do any additional setup after loading the view, typically from a nib.
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  </code></pre>
  
  <p>}
  }</p>