Executes blocks submitted to the main queue.


func dispatchMain() -> Never

Return Value

This function never returns.


This function "parks" the main thread and waits for blocks to be submitted to the main queue. Applications that call UIApplicationMain(_:_:_:_:) (iOS), NSApplicationMain(_:_:) (macOS), or CFRunLoopRun() on the main thread must not call dispatchMain().

See Also

Managing Dispatch Queues

class DispatchQueue

DispatchQueue manages the execution of work items. Each work item submitted to a queue is processed on a pool of threads managed by the system.

class DispatchSpecificKey

DispatchSpecificKey is a class that encapsulates keys that can be associated with a contextual value on a DispatchQueue using the setSpecific<T>(key:value:) method, and accessed using the getSpecific<T>(key:) method.

func dispatch_get_current_queue() -> DispatchQueue

Returns the queue on which the currently executing block is running.

func setTarget(queue: DispatchQueue?)

Sets the target queue for the given object.