Instance Methodswift 6.1.2Dispatch

sync(flags:execute:)

Submits a block for synchronous execution on this queue.

func sync<T>(flags: DispatchWorkItemFlags, execute work: () throws -> T) rethrows -> T

Parameters

flags

flags that control the execution environment of the

execute

The work item to be invoked on the queue.

Submits a work item to a dispatch queue like sync(execute:), and returns the value, of type T, returned by that work item.

  • returns the value returned by the work item.