---
title: "sync(execute:)"
framework: dispatch
role: symbol
role_heading: Instance Method
path: "dispatch/dispatchqueue/sync(execute:)-20xby"
---

# sync(execute:)

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

## Declaration

```swift
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 doc://com.apple.dispatch/documentation/Dispatch/DispatchWorkItem.

## Return Value

Return Value The return value of the item in the work parameter.

## See Also

### Executing Tasks Synchronously

- [sync(execute:)](dispatch/dispatchqueue/sync(execute:)-2fzvo.md)
- [sync(execute:)](dispatch/dispatchqueue/sync(execute:)-3segw.md)
- [sync(flags:execute:)](dispatch/dispatchqueue/sync(flags:execute:).md)
- [asyncAndWait(execute:)](dispatch/dispatchqueue/asyncandwait(execute:)-1udeu.md)
