c++objective-cmacoscocoawxwidgets

The equivalent of wxYield in Cocoa


I'm new to MacOS programming. I'm using Objective-C with XIB interfaces to develop Mac Apps.

I'm making an app that zips and unzips files/folders. I've also implemented a progress bar to show the progress of the task.

But, when the user drops a big file to compress the app freezes, the progress window never gets displayed but the logs are working fine though.

I remember when I was using wxWidgets, in a case like that I'd have to use wxYield() to process the events and update the ui and everything would be fine.

So, what's the way to do this thing on Cocoa?


Solution

  • I worked it using @Willeke's suggestions.

    I'm executing the zip_close function on a different thread letting the main one handle the UI updates & events.

    Also when the progress callback gets emitted, I'm updating the UI by accessing the main thread (making changes to the UI from another thread will give warnings).

    Thank you both @Igor and @Willeke for helping out!