---
title: "stopProxy(with:completionHandler:)"
framework: networkextension
role: symbol
role_heading: Instance Method
path: "networkextension/nednsproxyprovider/stopproxy(with:completionhandler:)"
---

# stopProxy(with:completionHandler:)

Stops the DNS proxy.

## Declaration

```swift
func stopProxy(with reason: NEProviderStopReason, completionHandler: @escaping @Sendable () -> Void)
```

```swift
func stopProxy(with reason: NEProviderStopReason) async
```

## Parameters

- `reason`: A code indicating why the proxy is being stopped.
- `completionHandler`: A block that must be called when the proxy is completely stopped.

## Discussion

Discussion Subclasses of NEDNSProxyProvider must override this method to perform whatever steps are necessary to stop the proxy. The system calls this method to stop the proxy. You indicate that the proxy is fully stopped by calling the completion handler. important: Don’t call this method to stop the proxy from within the proxy provider itself. Call cancelProxyWithError(_:) instead.

## See Also

### Managing the DNS proxy life cycle

- [startProxy(options:completionHandler:)](networkextension/nednsproxyprovider/startproxy(options:completionhandler:).md)
- [cancelProxyWithError(_:)](networkextension/nednsproxyprovider/cancelproxywitherror(_:).md)
