---
title: configuration
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlsession/configuration
---

# configuration

A copy of the configuration object for this session.

## Declaration

```swift
@NSCopying var configuration: URLSessionConfiguration { get }
```

## Mentioned in

Accessing cached data

## Discussion

Discussion Beginning in iOS 9 and OS X 10.11, URLSession objects store a copy of the URLSessionConfiguration object passed to their initializers, such that a session’s configuration is immutable after initialization. Any further changes to mutable properties on the configuration object passed to a session’s initializer or the value returned from a session’s configuration property do not affect the behavior of that session. However, you can create a new session with the modified configuration object. note: On previous versions of iOS and macOS, a bug in the implementation causes URLSession objects to store a reference to configuration objects passed to their initializers rather than a copy. This allows the behavior of a session to be further configured after initialization by modifying the configuration object passed to a session’s initializer or the value returned from a session’s configuration property. You can ensure consistent behavior across different platform versions by explicitly calling copy() on configuration objects passed to a URLSession initializer or returned from the configuration property.

## See Also

### Creating a session

- [init(configuration:)](foundation/urlsession/init(configuration:).md)
- [init(configuration:delegate:delegateQueue:)](foundation/urlsession/init(configuration:delegate:delegatequeue:).md)
- [URLSessionConfiguration](foundation/urlsessionconfiguration.md)
