Run Loops and Timers

Run loops are described with more detail in Chapter 8, “The Application Kit Framework Overview,” because most features of run loops apply to applications with graphical user interfaces. However, run loops are implemented within the Foundation framework by the NSRunLoop class, and some features of the Foundation framework such as timers rely upon run loops. Each thread in a Cocoa application has one corresponding NSRunLoop instance that helps the thread communicate with the operating system. The run loop for the main thread in each application is created automatically. Other threads need to create an NSRunLoop instance in code.

NSRunLoop

An instance of the NSRunLoop class monitors a set of possible input sources from the ...

Get Cocoa® Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.