---
title: expirationHandler
framework: watchkit
role: symbol
role_heading: Instance Property
path: watchkit/wkrefreshbackgroundtask/expirationhandler
---

# expirationHandler

A block that the system calls when the available runtime for a background task is about to expire.

## Declaration

```swift
var expirationHandler: (() -> Void)? { get set }
```

## Mentioned in

Using background tasks

## Discussion

Discussion To respond when your background task is about to expire, assign a block to this property. In this block, clean up any running background tasks, and prepare for the system to suspend your app.

## See Also

### Completing the background task

- [setTaskCompletedWithSnapshot(_:)](watchkit/wkrefreshbackgroundtask/settaskcompletedwithsnapshot(_:).md)
- [setTaskCompleted()](watchkit/wkrefreshbackgroundtask/settaskcompleted().md)
