<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NetworkExtension",
  "identifier" : "/documentation/NetworkExtension/NEDNSProxyProvider/stopProxy(with:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:objc(cs)NEDNSProxyProvider(im)stopProxyWithReason:completionHandler:"
  },
  "title" : "stopProxy(with:completionHandler:)"
}
-->

# stopProxy(with:completionHandler:)

Stops the DNS proxy.

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

## 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

Subclasses of [`NEDNSProxyProvider`](/documentation/NetworkExtension/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 ``doc://com.apple.networkextension/documentation/NetworkExtension/NEDNSProxyProvider/cancelProxyWithError(_:)`` instead.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)