<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NetworkExtension",
  "identifier" : "/documentation/NetworkExtension/NEFilterDataProvider",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:objc(cs)NEFilterDataProvider"
  },
  "title" : "NEFilterDataProvider"
}
-->

# NEFilterDataProvider

The principal class for a filter data provider extension.

```
class NEFilterDataProvider
```

## Overview

Network content is delivered to the Filter Data Provider in the form of [`NEFilterFlow`](/documentation/NetworkExtension/NEFilterFlow) objects. Each [`NEFilterFlow`](/documentation/NetworkExtension/NEFilterFlow) object corresponds to a network connection opened by an application running on the device. The Filter Data Provider can choose to pass or block the data when it receives a new flow, or it can ask the system to see more of the flow’s data in either the outbound or inbound direction before making a pass or block decision.

In addition to passing or blocking network data, the Filter Data Provider can tell the system that it needs more information before it can make a decision about a particular flow of data. The system will then ask the Filter Control Provider to update the current set of rules and place them in a location on disk that is readable from the Filter Data Provider extension.

When a [`NEFilterFlow`](/documentation/NetworkExtension/NEFilterFlow) object is originated from a WebKit browser object, the Filter Data Provider can affect the user experience in the following ways:

- If the Filter Data Provider chooses to block the web page, then a special “block” page is displayed in the WebKit browser object informing the user that their attempt to access the content was blocked. The Filter Data Provider can choose to add a link to this block page, giving the user the option of requesting access to the content.
- If the Filter Data Provider chooses to allow the web page, then it can also specify that a string be appended to the web page URL. This allows the Filter Data Provider to direct the WebKit browser object to a “safe” version of the web page.

To protect the user’s privacy, the Filter Data Provider extension sandbox prevents the extension from moving network content outside of its address space.

> Important:
> To use the ``doc://com.apple.networkextension/documentation/NetworkExtension/NEFilterDataProvider/handleNewFlow(_:)`` method, you must enable the Network Extensions capability in Xcode and select the Content Filter capability. See [Configure network extensions](http://help.apple.com/xcode/mac/current/#/dev0b2ef6f08).

### Creating a Filter Data Provider Extension

Filter Data Providers run as App Extensions for the `com.apple.networkextension.filter-data` extension point.

To create a Filter Data Provider extension, first create a new App Extension target in your project.

For an example of an Xcode build target for this app extension, see the [SimpleTunnel: Customized Networking Using the NetworkExtension Framework](https://developer.apple.com/library/archive/samplecode/SimpleTunnel/Introduction/Intro.html#//apple_ref/doc/uid/TP40016140) sample code project.

Once you have a Filter Data Provider extension target, create a subclass of `NEFilterDataProvider`. Then set the `NSExtensionPrincipalClass` key in the the extension’s `Info.plist` to the name of your subclass.

If it is not done already, set the `NSExtensionPointIdentifier` key in the extension’s `Info.plist` to `com.apple.networkextension.filter-data`.

Here is an example of the `NSExtension` dictionary in a Filter Data Provider extension’s `Info.plist`:

```xml
<key>NSExtension</key>
<dict>
    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.networkextension.filter-data</string>
    <key>NSExtensionPrincipalClass</key>
    <string>MyCustomFilterDataProvider</string>
</dict>
```

Finally, add your Filter Data Provider extension target to your app’s Embed App Extensions build phase.

### Subclassing Notes

To create a Filter Data Provider extension, you must first create a subclass of `NEFilterDataProvider` and override the methods listed below.

#### Methods to Override

- [`handleNewFlow(_:)`](/documentation/NetworkExtension/NEFilterDataProvider/handleNewFlow(_:))
- [`handleInboundData(from:readBytesStartOffset:readBytes:)`](/documentation/NetworkExtension/NEFilterDataProvider/handleInboundData(from:readBytesStartOffset:readBytes:))
- [`handleOutboundData(from:readBytesStartOffset:readBytes:)`](/documentation/NetworkExtension/NEFilterDataProvider/handleOutboundData(from:readBytesStartOffset:readBytes:))
- [`handleInboundDataComplete(for:)`](/documentation/NetworkExtension/NEFilterDataProvider/handleInboundDataComplete(for:))
- [`handleOutboundDataComplete(for:)`](/documentation/NetworkExtension/NEFilterDataProvider/handleOutboundDataComplete(for:))
- [`handleRemediation(for:)`](/documentation/NetworkExtension/NEFilterDataProvider/handleRemediation(for:))
- [`handleRulesChanged()`](/documentation/NetworkExtension/NEFilterDataProvider/handleRulesChanged())

## Topics

### Filtering network content

[`handleNewFlow(_:)`](/documentation/NetworkExtension/NEFilterDataProvider/handleNewFlow(_:))

Make a filtering decision for a newly-created flow of network content.

[`handleInboundData(from:readBytesStartOffset:readBytes:)`](/documentation/NetworkExtension/NEFilterDataProvider/handleInboundData(from:readBytesStartOffset:readBytes:))

Make a filtering decision about a chunk of inbound data.

[`NEFilterDataAttribute`](/documentation/NetworkExtension/NEFilterDataAttribute)

Attribute flags that describe the data handled by a filter.

[`handleOutboundData(from:readBytesStartOffset:readBytes:)`](/documentation/NetworkExtension/NEFilterDataProvider/handleOutboundData(from:readBytesStartOffset:readBytes:))

Make a filtering decision about a chunk of outbound data.

[`handleInboundDataComplete(for:)`](/documentation/NetworkExtension/NEFilterDataProvider/handleInboundDataComplete(for:))

Make a filtering decision after seeing all of the inbound data for a flow.

[`handleOutboundDataComplete(for:)`](/documentation/NetworkExtension/NEFilterDataProvider/handleOutboundDataComplete(for:))

Make a filtering decision after seeing all of the outbound data for a flow.

### Handling remediation

[`handleRemediation(for:)`](/documentation/NetworkExtension/NEFilterDataProvider/handleRemediation(for:))

Handle a remediation request.

### Handling rule updates

[`handleRulesChanged()`](/documentation/NetworkExtension/NEFilterDataProvider/handleRulesChanged())

Handle a rules changed event.

### Changing filter settings

[`apply(_:completionHandler:)`](/documentation/NetworkExtension/NEFilterDataProvider/apply(_:completionHandler:))

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

[`NEFilterSettings`](/documentation/NetworkExtension/NEFilterSettings)

The rules and other settings that define the operation of a filter.

### Resuming data flows

[`resumeFlow(_:with:)`](/documentation/NetworkExtension/NEFilterDataProvider/resumeFlow(_:with:))

Resumes a previously-paused flow.

### Updating filter verdicts

[`update(_:using:for:)`](/documentation/NetworkExtension/NEFilterDataProvider/update(_:using:for:))

Updates the verdict for a flow outside the context of any filter data provider callback.



---

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)