---
title: "init(response:data:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/cachedurlresponse/init(response:data:)"
---

# init(response:data:)

Creates a cached URL response instance.

## Declaration

```swift
init(response: URLResponse, data: Data)
```

## Parameters

- `response`: The response to cache.
- `data`: The data to cache.

## Return Value

Return Value A cached URL response object, containing the response and data.

## Discussion

Discussion The cache storage policy is set to the default, URLCache.StoragePolicy.allowed, and the user info dictionary is set to nil.

## See Also

### Creating a cached URL response

- [init(response:data:userInfo:storagePolicy:)](foundation/cachedurlresponse/init(response:data:userinfo:storagepolicy:).md)
