<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLProtocolClient",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(pl)NSURLProtocolClient"
  },
  "title" : "URLProtocolClient"
}
-->

# URLProtocolClient

The interface used by [`URLProtocol`](/documentation/Foundation/URLProtocol) subclasses to communicate with the URL Loading System.

```
protocol URLProtocolClient : NSObjectProtocol, Sendable
```

## Overview

Don’t implement this protocol in your application. Instead, your [`URLProtocol`](/documentation/Foundation/URLProtocol) subclass calls methods of this protocol on its own [`client`](/documentation/Foundation/URLProtocol/client) property.

## Topics

### Creating a response

[`urlProtocol(_:didReceive:cacheStoragePolicy:)`](/documentation/Foundation/URLProtocolClient/urlProtocol(_:didReceive:cacheStoragePolicy:))

Tells the client that the protocol implementation has created a response object for the request.

### Handling redirects

[`urlProtocol(_:wasRedirectedTo:redirectResponse:)`](/documentation/Foundation/URLProtocolClient/urlProtocol(_:wasRedirectedTo:redirectResponse:))

Tells the client that the protocol implementation has been redirected.

### Working with cache data

[`urlProtocol(_:cachedResponseIsValid:)`](/documentation/Foundation/URLProtocolClient/urlProtocol(_:cachedResponseIsValid:))

Tells the client that a cached response is valid.

### Handling authentication challenges

[`urlProtocol(_:didCancel:)`](/documentation/Foundation/URLProtocolClient/urlProtocol(_:didCancel:))

Tells the client that an authentication challenge has been canceled.

[`urlProtocol(_:didReceive:)`](/documentation/Foundation/URLProtocolClient/urlProtocol(_:didReceive:))

Tells the client that the URL Loading System received an authentication challenge.

### Indicating loading progress or failure

[`urlProtocol(_:didFailWithError:)`](/documentation/Foundation/URLProtocolClient/urlProtocol(_:didFailWithError:))

Tells the client that the load request failed due to an error.

[`urlProtocol(_:didLoad:)`](/documentation/Foundation/URLProtocolClient/urlProtocol(_:didLoad:))

Tells the client that the protocol implementation has loaded some data.

[`urlProtocolDidFinishLoading(_:)`](/documentation/Foundation/URLProtocolClient/urlProtocolDidFinishLoading(_:))

Tells the client that the protocol implementation has finished loading.



---

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)