---
title: "apply(_:completionHandler:)"
framework: networkextension
role: symbol
role_heading: Instance Method
path: "networkextension/nefilterdataprovider/apply(_:completionhandler:)"
---

# apply(_:completionHandler:)

Applies a set of filtering rules associated with the provider and changes the default filtering action.

## Declaration

```swift
func apply(_ settings: NEFilterSettings?, completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
func apply(_ settings: NEFilterSettings?) async throws
```

## Parameters

- `settings`: A doc://com.apple.networkextension/documentation/NetworkExtension/NEFilterSettings object containing the filter settings to apply to the system. Pass nil to revert to the default settings, which are an empty list of rules and a default action of doc://com.apple.networkextension/documentation/NetworkExtension/NEFilterAction/filterData.
- `completionHandler`: A Swift closure or ObjectiveC block that executes when the system finishes applying the settings. It receives an doc://com.apple.documentation/documentation/Foundation/NSError parameter; a non-nil value that indicates there’s an error contidition.

## See Also

### Changing filter settings

- [NEFilterSettings](networkextension/nefiltersettings.md)
