The principal class for a filter control provider extension.
- iOS 9.0+
- Mac Catalyst 13.0+
The Filter Control Provider’s primary responsibility is to provide information to the associated Filter Data Provider so that it can perform its task of accurately filtering network content. There are several ways in which the Filter Control Provider provides data to the associated Filter Data Provider:
By writing information to disk. For example, the Filter Control Provider can maintain a database of filtering rules on disk in a location where the Filter Data Provider can read from the database.
By defining a dictionary that maps keys to sets of customization parameters to be used when generating the block page. The Filter Data Provider gives the system the key for the desired customization parameters, and the system uses that key to get the customization parameters from the Filter Control Provider and generate the customized block page.
By defining a dictionary that maps keys to strings to be appended to URLs. The Filter Data Provider gives the system the key for the string to be appended, and the system uses that key to get the string to be appended from the Filter Control Provider and appends the string to the URL.
Creating a Filter Control Provider Extension
Filter Control Providers run as App Extensions for the
com extension point.
To create a Filter Control 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 sample code project.
Once you have a Filter Control Provider extension target, create a sub-class of
NEFilter. Then, set the
NSExtension key in the the extension’s
Info to the name of your subclass.
If it is not already, set the
NSExtension key in the extension’s
Here is an example of the
NSExtension dictionary in a Filter Control Provider extension’s
Finally, add your Filter Control Provider extension target to your app’s Embed App Extensions build phase.