---
title: delegate
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlsessiontask/delegate
---

# delegate

A delegate specific to the task.

## Declaration

```swift
var delegate: (any URLSessionTaskDelegate)? { get set }
```

## Discussion

Discussion This task-specific delegate receives messages from the task before the session’s delegate receives them. This is similar to the behavior of the delegate parameter used by the asychronous methods in URLSession like bytes(for:delegate:) and data(for:delegate:).

## See Also

### Using a task-specific delegate

- [URLSessionTaskDelegate](foundation/urlsessiontaskdelegate.md)
