Class

NEFilterManager

Create and manage network content filter configurations and to control network content filters.

Overview

Each app is allowed to create a single filter configuration. The NEFilterManager class has a class method (shared()) that provides access to a single NEFilterManager instance. This single instance corresponds to a single filter configuration.

The filter configuration is stored in the Network Extension preferences which are managed by the Network Extension framework. The filter configuration must be explicitly loaded into memory from the Network Extension preferences before it can be used, and any changes must be explicitly saved to the Network Extension preferences before taking effect on the system.

Profile Configuration

Filter configurations are created using configuration profiles. See the com.apple.webcontent-filter payload type in Configuration Profile Reference. To specify that a filter configuration created via a profile payload is associated with a particular app (and therefore allow the app to use NEFilterManager to manage the configuration), the app’s bundle identifier must be set as the value of the PluginBundleID field in the profile payload.

Filter Provider Extensions

Apps that use NEFilterManager are required to contain two Filter Provider extensions that together perform the task of examining network content and making pass and block decisions. See the NEFilterControlProvider and NEFilterDataProvider classes for more details about these extensions.

Topics

Managing the Filter Configuration

class func shared() -> NEFilterManager

Access the single instance of NEFilterManager.

func loadFromPreferences(completionHandler: (Error?) -> Void)

Load the filter configuration from the Network Extension preferences.

func saveToPreferences(completionHandler: (Error?) -> Void)

Save the filter configuration in the Network Extension preferences.

func removeFromPreferences(completionHandler: (Error?) -> Void)

Remove the filter configuration from the Network Extension preferences.

Set the Filter Configuration Parameters

var localizedDescription: String?

A string containing a description of the filter configuration.

var isEnabled: Bool

A Boolean used to toggle the enabled state of the filter.

Notifications

static let NEFilterConfigurationDidChange: NSNotification.Name

Posted after the filter configuration stored in the Network Extension preferences changes.

Relationships

Inherits From

Conforms To