<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLSessionConfiguration/protocolClasses",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLSessionConfiguration(py)protocolClasses"
  },
  "title" : "protocolClasses"
}
-->

# protocolClasses

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

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

## Discussion

The objects in this array are `Class` objects corresponding to custom [`URLProtocol`](/documentation/Foundation/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`](/documentation/Foundation/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:)`](/documentation/Foundation/URLProtocol/canInit(with:)-76brg) class method returns <doc://com.apple.documentation/documentation/Swift/true>, indicating that the class is capable of handling the specified request.

> Note:
> You cannot use custom ``doc://com.apple.foundation/documentation/Foundation/URLProtocol`` subclasses in conjunction with background sessions.

The default value is an empty array.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)