Concurrency and UIKit

In fact, GCD is already splitting our work onto multiple queues. All our user interface events run on the main queue, the queue that launches the app and is responsible for listening for user interface events. When we get a button tap, the call into our code is made on the main queue. When a table asks our code for the number or rows or the cell at a given index path, it’s on the main queue. In fact, UIKit has a rule: calls to any method or property must be made on the main queue.

But when we perform certain other tasks, GCD will put that work on other queues. For example, since network calls are sometimes slow (and never predictable in how long they’ll take), most of them are put onto other queues, which allows the UIKit ...

Get iOS 8 SDK Development, 2nd Edition 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.