---
title: "setDelegate(_:queue:)"
framework: AVFoundation
role: symbol
role_heading: Instance Method
platforms: [iOS 26.0+, iPadOS 26.0+, Mac Catalyst 26.0+, macOS 26.0+, tvOS 26.0+]
path: "avfoundation/avcapturetimecodegenerator/setdelegate(_:queue:)"
---

# setDelegate(_:queue:)

Assigns a delegate to receive real-time timecode updates and specifies a queue for callbacks.

## Declaration

```swift
func setDelegate(_ delegate: (any AVCaptureTimecodeGeneratorDelegate)?, queue callbackQueue: dispatch_queue_t?)
```

## Parameters

- `delegate`: An object conforming to the doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureTimecodeGeneratorDelegate protocol.
- `callbackQueue`: The dispatch queue on which the delegate methods are invoked. The callbackQueue parameter may not be nil, except when setting the doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureTimecodeGeneratorDelegate to nil, otherwise doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureTimecodeGenerator/setDelegate(_:queue:) throws an NSInvalidArgumentException.

## Discussion

Discussion Use this method to configure a delegate that handles timecode updates. The specified queue ensures thread-safe invocation of delegate methods.

## See Also

### Configuring the generator

- [synchronizationTimeout](avfoundation/avcapturetimecodegenerator/synchronizationtimeout.md)
- [timecodeAlignmentOffset](avfoundation/avcapturetimecodegenerator/timecodealignmentoffset.md)
- [timecodeFrameDuration](avfoundation/avcapturetimecodegenerator/timecodeframeduration.md)
