---
title: dispatchMain()
framework: dispatch
role: symbol
role_heading: Function
path: dispatch/dispatchmain()
---

# dispatchMain()

Executes blocks submitted to the main queue.

## Declaration

```swift
func dispatchMain() -> Never
```

## Discussion

Discussion 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(). This function never returns.
