<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/DispatchQueue/sync(execute:)-20xby",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "s:So17OS_dispatch_queueC8DispatchE4sync7executexxyKXE_tKlF"
  },
  "title" : "sync(execute:)"
}
-->

# sync(execute:)

Submits a work item for execution and returns the results from that item after it finishes executing.

```
func sync<T>(execute work: () throws -> T) rethrows -> T
```

## Parameters

`work`

The work item containing the work to perform. The block encapsulated by the work item should return a result, which is then returned by this method. For information on how to create this work item, see [`DispatchWorkItem`](/documentation/Dispatch/DispatchWorkItem).

## Return Value

The return value of the item in the `work` parameter.

## Discussion

---

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)