Contents

main

The dispatch queue associated with the main thread of the current process.

Declaration

class var main: DispatchQueue { get }

Discussion

The system automatically creates the main queue and associates it with your application’s main thread. Your app uses one (and only one) of the following three approaches to execute blocks submitted to the main queue:

As with the global concurrent queues, calls to suspend(), resume(), dispatch_set_context, and the like have no effect when used on the queue in this property.

If your app has a long running task, such as making network call, run it on a global system queue, or on another background dispatch queue. Alternatively, use asynchronous versions of the call, if available.

See Also

Creating a Dispatch Queue