I understand that all updates to the UI need to happen on the main thread. I have code that makes an Alamofire request and updates the user with the progress made as it parses each item from the JSON response. I have placed `dispatch_async(dispatch_get_main_queue()){}` around the line that sets the text of a `UILabel`, and yet the label does not update. My `for` loop prints to the logs “We’re on item 0”, “We’re on item 1”, etc. and the whole time my label text never shows up. If I update the label after my `getPhotoCollection()` function is over, the label text displays as expected — so there’s nothing wrong with my UILabel itself.

I have found countless Stack Overflow posts saying that if you want to update the UI from code that isn’t on the main thread, simply wrap it in `dispatch_async(dispatch_get_main_queue()){}`. So why is that not working?

Here is my code. I have left some irrelevant parts in it in case they are part of why this issue is occurring.

```
func getPhotoCollection(urlString: String, finished: (success: Bool, numResults: Int) -> Void) {
    Alamofire.request(.GET, urlString, parameters: nil, encoding: .JSON)
        .validate()
        .responseJSON { (response) -> Void in
            guard response.result.isSuccess else {
                finished(success: false, numResults: 0)
                return
             }  
            let json = response.result.value!
            if let items = json["items"] as? NSArray {
                 let numResults = items.count
                 if numResults > 0 {    
                     self.photoArray.removeAll()
                     var itemNum = 0
                     for item in items {
                         var photo: UIImage!                        
                         let jsonItem = JSON(item)
                         let photoURLString = jsonItem["url"].stringValue
                         let url = NSURL(string: photoURLString)
                         print("We're on item \(itemNum)")
                         if let imageData = NSData(contentsOfURL: url!) {
                             dispatch_async(dispatch_get_main_queue()) {
                                 self.progressLabel.text = String(itemNum + 1) + " photos found"
                             }
                             photo = UIImage(data: data)
                             self.photoArray.append(photo)
                             itemNum++
                            }
                        }
                    }
                    finished(success: true, numResults: numResults)
                    return
                }
            }       
        }
    }

```