From the course: iOS Development: Threading and Grand Central Dispatch

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

The main queue

The main queue

From the course: iOS Development: Threading and Grand Central Dispatch

Start my 1-month free trial

The main queue

- [Instructor] Grand central dispatch provides three Queues for us to work with. One of them is the main queue. When you create an application, a main thread is created too and it's associated with your application. You only get one main thread in an application and this is why the main thread has the highest priority, when you talk about QoS Quality of Service in queues. You may have seen the main queue in action already. If you look at the app delegate file that is automatically created with the new project, just before the class declaration, we have @UI Application Main. This is one of the ways we execute code on the main queue. App delegate is the root of your app and your app can't run without it. It's there to handle the life cycle of your app. Another way to execute code on the main thread is by calling DispatchQueue.main.async. As a role, all UI updates should be made on the main queue. If not the user…

Contents