---
title: protocolClasses
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlsessionconfiguration/protocolclasses
---

# protocolClasses

An array of extra protocol subclasses that handle requests in a session.

## Declaration

```swift
var protocolClasses: [AnyClass]? { get set }
```

## Discussion

Discussion The objects in this array are Class objects corresponding to custom URLProtocol subclasses that you define. URL session objects support a number of common networking protocols by default. Use this array to extend the default set of common networking protocols available for use by a session with one or more custom protocols that you define. Prior to handling a request, the URLSession object searches the default protocols first and then checks your custom protocols until it finds one capable of handling the specified request. It uses the protocol whose canInit(with:) class method returns true, indicating that the class is capable of handling the specified request. note: You cannot use custom URLProtocol subclasses in conjunction with background sessions. The default value is an empty array.

## See Also

### Supporting custom protocols

- [URLProtocol](foundation/urlprotocol.md)
