title: Method is updating the UI after huge delay
body: <p>I have a <code>UIView</code> as parent and a <code>UIActivityIndicator</code> as a Subview. Whenever a user submit credentials i start the activity animation and assign the parentViews <em>alpha = 1.0</em> in a method name <code>startLoadingAnimator()</code> after this it calls an API and when the API finished calling i am setting to revert the Activity animation by stoping it and setting the parent view’s alpha = 0.0 in a method named <code>stopLoadingAnimator()</code>.
  Problem is that <code>stopLoadingAnimator()</code> is invoking perfectly on its time but the effect on screen it shows after the delay
  It should be like when method runs it should disappears at that instant but its taking very time to disappear.</p>
  
  <blockquote>
    <p>Stops the activity animation.</p>
  </blockquote>
  
  <pre><code>func stopLoadingAnimator() -&gt; Void {
      UIView.animateWithDuration(0.25, animations: {
  
          self.loadingView.alpha = 0
          self.activityIndicator.stopAnimating()
      })
  
  
  
  }
  </code></pre>
  
  <blockquote>
    <p>Starts the activity animation.</p>
  </blockquote>
  
  <pre><code>func startLoadingAnimator() -&gt; Void {
      UIView.animateWithDuration(0.25, animations: {
  
          self.loadingView.alpha = 1
          self.activityIndicator.startAnimating()
  
      })
  }
  </code></pre>
  
  <blockquote>
    <p>Api Method</p>
  </blockquote>
  
  <pre><code>    func connectToWebWith(username:String, password:String) -&gt; Void {
          self.startLoadingAnimator()
          let params = ["email":username, "password":password]
  
  //        params.setValue(username, forKey: "email")
  //        params.setValue(password, forKey: "password")
  
          let request = NSMutableURLRequest(URL: NSURL(string: "https://callvabo.com/user/signin")!)
          let session = NSURLSession.sharedSession()
          request.HTTPMethod = "POST"
  
          do {
              request.HTTPBody = try NSJSONSerialization.dataWithJSONObject(params, options: .PrettyPrinted)
          } catch {
              self.stopLoadingAnimator()
  
              //handle error. Probably return or mark function as throws
              print(error)
              return
          }
          request.addValue("application/json", forHTTPHeaderField: "Content-Type")
          request.addValue("application/json", forHTTPHeaderField: "Accept")
  
          let task = session.dataTaskWithRequest(request, completionHandler: {data, response, error -&gt; Void in
              // handle error
              self.stopLoadingAnimator()
              guard error == nil else {
                  return
              }
  
              print("Response: \(response)")
              let strData = NSString(data: data!, encoding: NSUTF8StringEncoding)
              print("Body: \(strData)")
  
              let json: NSDictionary?
              do {
                  json = try NSJSONSerialization.JSONObjectWithData(data!, options: .MutableLeaves) as? NSDictionary
              } catch let dataError {
                  // Did the JSONObjectWithData constructor return an error? If so, log the error to the console
                  print(dataError)
                  let jsonStr = NSString(data: data!, encoding: NSUTF8StringEncoding)
                  print("Error could not parse JSON: '\(jsonStr)'")
                  // return or throw?
                  return
              }
  
  
              // The JSONObjectWithData constructor didn't return an error. But, we should still
              // check and make sure that json has a value using optional binding.
              if let parseJSON = json {
                  // Okay, the parsedJSON is here, let's get the value for 'success' out of it
                  let success = parseJSON["success"] as? Int
                  print("Succes: \(success)")
              }
              else {
                  // Woa, okay the json object was nil, something went worng. Maybe the server isn't running?
                  let jsonStr = NSString(data: data!, encoding: NSUTF8StringEncoding)
                  print("Error could not parse JSON: \(jsonStr)")
              }
  
          })
  
          task.resume()
      }
  </code></pre>