---
title: URLResponse
framework: foundation
role: symbol
role_heading: Class
path: foundation/urlresponse
---

# URLResponse

The metadata associated with the response to a URL load request, independent of protocol and URL scheme.

## Declaration

```swift
class URLResponse
```

## Mentioned in

Processing URL session data task results with Combine Downloading files from websites

## Overview

Overview The related HTTPURLResponse class is a commonly used subclass of URLResponse whose objects represent a response to an HTTP URL load request and store additional protocol-specific information such as the response headers. Whenever you make an HTTP request, the URLResponse object you get back is actually an instance of the HTTPURLResponse class. note: URLResponse objects don’t contain the actual bytes representing the content of a URL. Instead, the data is returned either a piece at a time through delegate calls or in its entirety when the request completes, depending on the method and class used to initiate the request. Read Fetching website data into memory to learn various ways to receive the content data from a URL load.

## Topics

### Creating a response

- [init(url:mimeType:expectedContentLength:textEncodingName:)](foundation/urlresponse/init(url:mimetype:expectedcontentlength:textencodingname:)-4s2s1.md)

### Getting the response properties

- [expectedContentLength](foundation/urlresponse/expectedcontentlength.md)
- [suggestedFilename](foundation/urlresponse/suggestedfilename.md)
- [mimeType](foundation/urlresponse/mimetype.md)
- [textEncodingName](foundation/urlresponse/textencodingname.md)
- [url](foundation/urlresponse/url.md)

### Initializers

- [init(URL:MIMEType:expectedContentLength:textEncodingName:)](foundation/urlresponse/init(url:mimetype:expectedcontentlength:textencodingname:)-3n1n4.md)
- [init(coder:)](foundation/urlresponse/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [HTTPURLResponse](foundation/httpurlresponse.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Requests and responses

- [URLRequest](foundation/urlrequest.md)
- [NSURLRequest](foundation/nsurlrequest.md)
- [NSMutableURLRequest](foundation/nsmutableurlrequest.md)
- [HTTPURLResponse](foundation/httpurlresponse.md)
