How do I update a progress bar using NSProgress using Cocoa Bindings?

I've been trying to use the new NSProgress class to report the progress of an operation in my Mac app. Right now, it's saved as a property in my App Delegate (and is updated from a different class and a different queue), and seems to be updated correctly, as proven by logging [_currentProgress fractionCompleted].

However, my issues come when I try to update a progress bar using the NSProgress object. I've got the progress bar set up with bindings something like this:

Binding Screenshot

The progress bar seems to stay on whatever my null placeholder is (as proven by changing the null placeholder to '1'), not redrawing or updating to accommodate any further progress. currentProgress is only set once an operation has started, which will be why the progress bar uses the null placeholder at first, but it makes no effort to update the progress bar when an NSProgress object is set to that property.

It'd be great if somebody could help me out here… (There must be something stupid I'm doing wrong!)


Unless you say otherwise I am going to assume you are using an indeterminate progress bar.

Cocoa NSProgressIndicator can be indeterminate, in which case it is a barber shop style swirly that is either moving or not:

A picture of an indeterminate progress bar

Or, they can be determinate, in which case it is a typical left to right wipe progress bar:

A picture of a determinate progress bar

Try unchecking indeterminate and seeing if your progress shows up using this settings:

Progress bar settings panel

I think the problem is that you cannot use bindings for fractionCompleted if the used NSProgress is being updated on a background queue. I am implementing this combo myself right now and I don't get a bar to appear via normal bindings like you. If I spect to KVO-observing it and setting the bar's doubleValue it works... as long I dispatch that onto the main queue.


 ? Cocoa bindings only update when window focus changes
 ? Download progress is not display in NSProgress when try download file from GoDaddy server url
 ? Massive memory growth with NSProgress
 ? Adding child progress for multiple file download
 ? NSProgress::completedUnitCount setter hangs
 ? How to track two NSProgress in parallel?
 ? uploadTask with progress using AFNetworking in Swift
 ? NSProgress when to remove the observer
 ? How to keep progress indicator running in javafx
 ? Swift: Setting progress of NSProgressIndicator