---
title: "init(qos:flags:block:)"
framework: dispatch
role: symbol
role_heading: Initializer
path: "dispatch/dispatchworkitem/init(qos:flags:block:)"
---

# init(qos:flags:block:)

Creates a new dispatch work item from an existing block and assigns it the specified quality-of-service class.

## Declaration

```swift
init(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], block: @escaping () -> Void)
```

## Parameters

- `qos`: The quality-of-service class to use when prioritizing the work item’s execution. For a list of possible values, see doc://com.apple.dispatch/documentation/Dispatch/DispatchQoS.
- `flags`: Configuration flags for the work item. For a list of possible values, see doc://com.apple.dispatch/documentation/Dispatch/DispatchWorkItemFlags.
- `block`: The block that performs the work.

## Discussion

Discussion Submit the returned dispatch work item to a queue to schedule it for execution in that queue. Dispatch queues may alter the specified quality-of-service level based on the specified flags and the quality-of-service level of the queue’s underlying threads. However, the queue never executes the block with a quality-of-service level lower than the one in the qos parameter. You can also execute the dispatch work item directly in the current context by calling its perform() method. When performing a work item directly, the system never executes the block with a quality-of-service level lower than the one in the qos parameter.

## See Also

### Creating a Work Item

- [DispatchWorkItemFlags](dispatch/dispatchworkitemflags.md)
