title: updating tableview after alamofire request completes
body: <p>I get a json block from my server which I then proceed to process into my managed objects and upon completion my table view is reloaded to show the new content and this works ok apart from one small problem.</p>
  
  <p>in the processing of the json I get a url for an image which I use an extension on UIImageView to get again using alamofire and this writes the downloaded image to disk.</p>
  
  <p>The problem is the image is supposed to be displayed on the same table row for its managed object but what happens is the processing of the entire json completes and returns to the tableview before the save to disk has completed so the images do not come through.</p>
  
  <p>how do I let the tableview know that each image is ready upon completed save so its related row can update?  </p>
  
  <p>extension UIImageView {</p>
  
  <pre><code>//
  // downloads image from supplied url and writes to disk using supplied destination path
  //
  func imageFromUrl(urlString: String, destinationPath: String) {
  
      Alamofire.request(.GET, urlString).response { _, _, data, _ in
  
          // only if we go data
          if let data = data {
  
              // cast to jpg image
              let imageData = NSData(data: UIImageJPEGRepresentation(UIImage(data: data)!, 1)!)
  
              // and write to disk
              imageData.writeToFile(destinationPath, atomically: true)
          }
      }
  }
  </code></pre>
  
  <p>}</p>