title: NSProgressIndicator doesn't update until the end of the loop
body: <p>I'm making an app that does a very large amount of calculation for multiple files, and so to keep track of everything that's going on, I added an NSProgressIndicator (values 0-100).</p>
  
  <p>I also have a console in the app, so the <code>logConsole:</code> method writes to that console.</p>
  
  <p>My loop looks like this:</p>
  
  <pre><code>dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
  
      for(int i = 0; i &lt; _files.count; i++)
      {
  
          //Do calculations
  
          dispatch_async(dispatch_get_main_queue(), ^(void){
  
              [_progressBar setDoubleValue: ((i+1) / _files.count) * 100];
              [self logConsole:[NSString stringWithFormat:@"Completed file #%d", (i+1)]];
  
          });
  
      }
  
  });
  </code></pre>
  
  <p>When this loop runs, the messages are logged to the app's console (not NSLog, the actual GUI console I made) asynchronously, but the progress bar doesn't change until the entire for-loop completes.</p>
  
  <p>So if there were 5 files it would look like this:</p>
  
  <pre><code>LOG: Completed file #1
  Progress bar at 0
  LOG: Completed file #2
  Progress bar at 0
  LOG: Completed file #3
  Progress bar at 0
  LOG: Completed file #4
  Progress bar at 0
  LOG: Completed file #5
  Progress bar at 100
  </code></pre>
  
  <p>Why isn't the progress bar updating? It's running on the main thread.</p>