I set up a label and a progress indicator to bind to the AppDelegate's progress
property. I then perform work on a concurrent queue. As each task finishes, I increase the progress by 1.
My problem is that the label updates tick-by-tick as expected but the progress indicator doesn't. It updates once every 15 ticks or so. Any idea how to make the progress indicator to move with every tick?
A simplified example:
class AppDelegate: NSObject, NSApplicationDelegate {
dynamic var progress = 0
@IBAction func updateProgress(sender : AnyObject) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
guard self.progress < 100 else {
return
}
self.progress += 1
sleep(1)
self.updateProgress(sender)
}
}
}