Cocoa main loop updating

Just after an application is launched, it sets up the infrastructure for the main event loop.It establishes a connection with those underlying system components that are responsible for the delivery of low-level user events.When porting a GUI library to another platform, such as porting GTK to OS X, the main loops of GTK and the native toolkit of the platform need to be integrated.

cocoa main loop updating-8cocoa main loop updating-38

To avoid this, you should shorten the amount of time consumed by those operations, defer their execution, or move them to secondary threads.

If you have operations that can be deferred or broken into chunks and performed incrementally, doing so can help performance.

In this blog post, we will have a look at the “main loop”, which is the engine of most Graphical User Interface (GUI) libraries.

Different GUI libraries implement their own main loop.

The application receives these events through an input source installed in the main thread’s run loop.