---
title: "sleep(completionHandler:)"
framework: networkextension
role: symbol
role_heading: Instance Method
path: "networkextension/neprovider/sleep(completionhandler:)"
---

# sleep(completionHandler:)

Handle a sleep event.

## Declaration

```swift
func sleep(completionHandler: @escaping @Sendable () -> Void)
```

```swift
func sleep() async
```

## Parameters

- `completionHandler`: Implementations of this method must execute this block when the provider is finished handling the sleep event.

## Discussion

Discussion This method is called by the system when the device is about to go to sleep. NEProvider subclasses should override this method if the provider needs to perform any tasks before the device sleeps, such as disconnecting a tunnel connection.

## See Also

### Handling sleep and wake

- [wake()](networkextension/neprovider/wake().md)
