---
title: URL Loading System
framework: foundation
role: collectionGroup
role_heading: API Collection
path: foundation/url-loading-system
---

# URL Loading System

Interact with URLs and communicate with servers using standard Internet protocols.

## Overview

Overview The URL Loading System provides access to resources identified by URLs, using standard protocols like https or custom protocols you create. Loading is performed asynchronously, so your app can remain responsive and handle incoming data or errors as they arrive. You use a URLSession instance to create one or more URLSessionTask instances, which can fetch and return data to your app, download files, or upload data and files to remote locations. To configure a session, you use a URLSessionConfiguration object, which controls behavior like how to use caches and cookies, or whether to allow connections on a cellular network. You can use one session repeatedly to create tasks. For example, a web browser might have separate sessions for regular and private browsing use, where the private session doesn’t cache its data. Figure 1 shows how two sessions with these configurations can then create multiple tasks.

Each session is associated with a delegate to receive periodic updates (or errors). The default delegate calls a completion handler block that you provide; if you choose to provide your own custom delegate, this block is not called. You can configure a session to run in the background, so that while the app is suspended, the system can download data on its behalf and wake up the app to deliver the results.

## Topics

### Essentials

- [Fetching website data into memory](foundation/fetching-website-data-into-memory.md)
- [Analyzing HTTP traffic with Instruments](foundation/analyzing-http-traffic-with-instruments.md)
- [URLSession](foundation/urlsession.md)
- [URLSessionTask](foundation/urlsessiontask.md)

### Requests and responses

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

### Uploading

- [Building a resumable upload server with SwiftNIO](foundation/building-a-resumable-upload-server-with-swiftnio.md)
- [Uploading data to a website](foundation/uploading-data-to-a-website.md)
- [Uploading streams of data](foundation/uploading-streams-of-data.md)
- [Pausing and resuming uploads](foundation/pausing-and-resuming-uploads.md)

### Downloading

- [Downloading files from websites](foundation/downloading-files-from-websites.md)
- [Pausing and resuming downloads](foundation/pausing-and-resuming-downloads.md)
- [Downloading files in the background](foundation/downloading-files-in-the-background.md)

### Cache behavior

- [Accessing cached data](foundation/accessing-cached-data.md)
- [CachedURLResponse](foundation/cachedurlresponse.md)
- [URLCache](foundation/urlcache.md)

### Authentication and credentials

- [Handling an authentication challenge](foundation/handling-an-authentication-challenge.md)
- [URLAuthenticationChallenge](foundation/urlauthenticationchallenge.md)
- [URLCredential](foundation/urlcredential.md)
- [URLCredentialStorage](foundation/urlcredentialstorage.md)
- [URLProtectionSpace](foundation/urlprotectionspace.md)

### Network activity attribution

- [Inspecting app activity data](network/inspecting-app-activity-data.md)
- [Indicating the source of network activity](network/indicating-the-source-of-network-activity.md)

### Cookies

- [HTTPCookie](foundation/httpcookie.md)
- [HTTPCookieStorage](foundation/httpcookiestorage.md)

### Errors

- [URLError](foundation/urlerror.md)
- [URL Loading System error info keys](foundation/url-loading-system-error-info-keys.md)

### Legacy

- [Legacy URL Loading Systems](foundation/legacy-url-loading-systems.md)

## See Also

### Networking

- [Bonjour](foundation/bonjour.md)
