<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/DispatchGroup/leave()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "c:@F@dispatch_group_leave"
  },
  "title" : "leave()"
}
-->

# leave()

Explicitly indicates that a block in the group finished executing.

```
func leave()
```

## Discussion

Calling this function decrements the current count of outstanding tasks in the group. Using this function (with [`enter()`](/documentation/Dispatch/DispatchGroup/enter())) allows your application to properly manage the task reference count if it explicitly adds and removes tasks from the group by a means other than using the [`dispatch_group_async`](/documentation/Dispatch/dispatch_group_async) function.

A call to this function must balance a call to [`enter()`](/documentation/Dispatch/DispatchGroup/enter()). It is invalid to call it more times than [`enter()`](/documentation/Dispatch/DispatchGroup/enter()), which would result in a negative count.

---

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)