Concurrent Dispatch Queues

Open the sample app, and select the row called Dispatch Queue-Concurrent. The five initial items in the table view are visible, and they are scrollable while the long-running tasks are being processed (view the debugging console to confirm that they are being processed while scrolling the table view). After the tasks are completed, the additional rows become visible. Notice that this approach completes significantly faster than any of the previous approaches.

To start the long-running tasks in the viewDidAppear: method, the app gets a reference to the high-priority concurrent dispatch queue:

dispatch_queue_t workQueue =dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);

Using

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK 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.