<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/DispatchGroup",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "c:objc(cs)OS_dispatch_group"
  },
  "title" : "DispatchGroup"
}
-->

# DispatchGroup

A group of tasks that you monitor as a single unit.

```
class DispatchGroup
```

## Overview

Groups allow you to aggregate a set of tasks and synchronize behaviors on the group. You attach multiple work items to a group and schedule them for asynchronous execution on the same queue or different queues. When all work items finish executing, the group executes its completion handler. You can also wait synchronously for all tasks in the group to finish executing.

## Topics

### Creating a Dispatch Group

[`init()`](/documentation/Dispatch/DispatchGroup/init())

Creates a new group to which you can assign block objects.

### Adding a Completion Handler

[`notify(qos:flags:queue:execute:)`](/documentation/Dispatch/DispatchGroup/notify(qos:flags:queue:execute:))

Schedules the submission of a block with the specified attributes to a queue when all tasks in the current group have finished executing.

[`notify(queue:work:)`](/documentation/Dispatch/DispatchGroup/notify(queue:work:))

Schedules the submission of a block to a queue when all tasks in the current group have finished executing.

### Waiting for Tasks to Finish Executing

[`wait()`](/documentation/Dispatch/DispatchGroup/wait())

Waits synchronously for the previously submitted work to finish.

[`wait(timeout:)`](/documentation/Dispatch/DispatchGroup/wait(timeout:))

Waits synchronously for the previously submitted work to complete, and returns if the work is not completed before the specified timeout period has elapsed.

[`wait(wallTimeout:)`](/documentation/Dispatch/DispatchGroup/wait(wallTimeout:))

Waits synchronously for the previously submitted work to complete, and returns if the work is not completed before the specified timeout period has elapsed.

### Updating the Group Manually

[`enter()`](/documentation/Dispatch/DispatchGroup/enter())

Explicitly indicates that a block has entered the group.

[`leave()`](/documentation/Dispatch/DispatchGroup/leave())

Explicitly indicates that a block in the group finished executing.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)