---
title: BackgroundTask
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/backgroundtask
---

# BackgroundTask

The kinds of background tasks that your app or extension can handle.

## Declaration

```swift
struct BackgroundTask<Request, Response>
```

## Overview

Overview Use a value of this type with the backgroundTask(_:action:) scene modifier to create a handler for background tasks that the system sends to your app or extension. For example, you can use urlSession to define an asynchronous closure that the system calls when it launches your app or extension to handle a response from a background URLSession.

## Topics

### Refreshing the app

- [appRefresh(_:)](swiftui/backgroundtask/apprefresh(_:).md)

### Receiving connectivity updates

- [bluetoothAlert](swiftui/backgroundtask/bluetoothalert.md)
- [watchConnectivity](swiftui/backgroundtask/watchconnectivity.md)

### Responding to URL sessions

- [urlSession](swiftui/backgroundtask/urlsession.md)
- [urlSession(_:)](swiftui/backgroundtask/urlsession(_:).md)
- [urlSession(matching:)](swiftui/backgroundtask/urlsession(matching:).md)

### Updating intents and shortcuts

- [intentDidRun](swiftui/backgroundtask/intentdidrun.md)
- [relevantShortcut](swiftui/backgroundtask/relevantshortcut.md)

### Processing tasks

- [processingTask(_:)](swiftui/backgroundtask/processingtask(_:).md)

### Deprecated symbols

- [appRefresh](swiftui/backgroundtask/apprefresh.md)
- [snapshot](swiftui/backgroundtask/snapshot.md)

## Relationships

### Conforms To

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Handling background tasks

- [backgroundTask(_:action:)](swiftui/scene/backgroundtask(_:action:).md)
- [SnapshotData](swiftui/snapshotdata.md)
- [SnapshotResponse](swiftui/snapshotresponse.md)
