title: Continuously update a UILabel in Swift
body: <p>I have a function, shown below, that I would like to continuously update. It is taking data from a webpage, and every so often that webpage is updated to reflect current information. Is there a way that I can catch this update and reflect that in my application? I'm pretty new to Swift and iOS programming. Some of the code made seem very bizarre, but it currently works for whatever song is playing when you first open the app (that is, it updates the text to show that song playing but doesn't update later).</p>
  
  <pre><code>    let url = NSURL(string: "http://api.vicradio.org/songs/current")!
      let request = NSMutableURLRequest(URL: url)
  
      let session = NSURLSession.sharedSession()
      let task = session.dataTaskWithRequest(request) { (data: NSData?, response: NSURLResponse?, error: NSError?) in
  
      if error != nil {
          return
      }
  
      let name = NSString(data: data!, encoding: NSUTF8StringEncoding) as! String
      var songName = ""
      var artistName = "by "
      var quoteNumber = 0
  
      for character in name.characters {
  
          if character == "\"" {
              quoteNumber++
          }
  
          if quoteNumber == 3 &amp;&amp; character != "\"" {
              songName += String(character)
          } else if quoteNumber == 7 &amp;&amp; character != "\"" {
              artistName += String(character)
          }
  
      }
  
      if (songName != "no song metadata provided") {
          self.SongNowText.text = songName
          self.ArtistNowText.text = artistName
          self.SongNowText.setNeedsDisplay()
          self.ArtistNowText.setNeedsDisplay()
      } else if (songName == "no song metadata provided") {
          self.SongNowText.text = "The Best of What's Next!"
          self.ArtistNowText.text = "only on VIC Radio"
      }
  
      }
  
      task!.resume()
  </code></pre>