---
title: "setDelegate(_:queue:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avcontentkeysession/setdelegate(_:queue:)"
---

# setDelegate(_:queue:)

Sets the session’s delegate object and the dispatch queue on which to call the delegate’s methods.

## Declaration

```swift
func setDelegate(_ delegate: (any AVContentKeySessionDelegate)?, queue delegateQueue: dispatch_queue_t?)
```

## Parameters

- `delegate`: An object that conforms to the doc://com.apple.avfoundation/documentation/AVFoundation/AVContentKeySessionDelegate protocol.
- `delegateQueue`: The dispatch queue on which the session calls the delegate object.

## See Also

### Managing the delegate object

- [delegate](avfoundation/avcontentkeysession/delegate.md)
- [delegateQueue](avfoundation/avcontentkeysession/delegatequeue.md)
