---
title: task
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlprotocol/task
---

# task

The protocol’s task.

## Declaration

```swift
@NSCopying var task: URLSessionTask? { get }
```

## See Also

### Getting protocol attributes

- [cachedResponse](foundation/urlprotocol/cachedresponse.md)
- [client](foundation/urlprotocol/client.md)
- [URLProtocolClient](foundation/urlprotocolclient.md)
- [request](foundation/urlprotocol/request.md)
