---
title: BGTask
framework: backgroundtasks
role: symbol
role_heading: Class
path: backgroundtasks/bgtask
---

# BGTask

An abstract class for the framework’s tasks.

## Declaration

```swift
class BGTask
```

## Mentioned in

Performing long-running tasks on iOS and iPadOS

## Overview

Overview With the exception of BGContinuedProcessingTask, which your app executes in the foreground, the system executes BGTask subclasses on behalf of your app, while your app is in the background.

## Topics

### Reading Task Information

- [identifier](backgroundtasks/bgtask/identifier.md)

### Configuring a Task

- [expirationHandler](backgroundtasks/bgtask/expirationhandler.md)
- [setTaskCompleted(success:)](backgroundtasks/bgtask/settaskcompleted(success:).md)

## Relationships

### Inherits From

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

### Inherited By

- [BGAppRefreshTask](backgroundtasks/bgapprefreshtask.md)
- [BGContinuedProcessingTask](backgroundtasks/bgcontinuedprocessingtask.md)
- [BGProcessingTask](backgroundtasks/bgprocessingtask.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Essentials

- [Background Tasks updates](updates/backgroundtasks.md)
- [BGTaskScheduler](backgroundtasks/bgtaskscheduler.md)
