Events and the Run Loop
Most graphical user interface toolkits, including the Application Kit, use an event-driven model. That simply means applications react to events that are sent to the application by the operating system. The events can result from the user typing on a keyboard, or moving a mouse. Timer events can be sent at periodic intervals. The arrival or availability of any new data from a monitored input source is also conceptually an event.
Cocoa applications receive events from the operating system with the help of the NSRunLoop class. Every Cocoa application contains at least one instance of the NSRunLoop class. A run loop is created automatically for each thread in the application. In most cases, the programmer does not need to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access