---
title: "setSpecific(key:value:)"
framework: dispatch
role: symbol
role_heading: Instance Method
path: "dispatch/dispatchqueue/setspecific(key:value:)"
---

# setSpecific(key:value:)

Sets the key/value data for the specified dispatch queue.

## Declaration

```swift
@preconcurrency func setSpecific<T>(key: DispatchSpecificKey<T>, value: T?) where T : Sendable
```

## Parameters

- `key`: The key that you use to identify the data.
- `value`: The data you want to associate with the queue.

## See Also

### Getting and Setting Contextual Data

- [getSpecific(key:)](dispatch/dispatchqueue/getspecific(key:)-swift.method.md)
- [getSpecific(key:)](dispatch/dispatchqueue/getspecific(key:)-swift.type.method.md)
- [DispatchSpecificKey](dispatch/dispatchspecifickey.md)
