Contents

compileContentRuleList(forIdentifier:encodedContentRuleList:completionHandler:)

Compiles the specified JSON content into a new rule list and adds it to the current data store.

Declaration

func compileContentRuleList(forIdentifier identifier: String!, encodedContentRuleList: String!, completionHandler: ((WKContentRuleList?, (any Error)?) -> Void)!)
func compileContentRuleList(forIdentifier identifier: String!, encodedContentRuleList: String!) async throws -> WKContentRuleList?

Parameters

  • identifier:

    A unique identifier for the new list. If a list with the specified identifier already exists in the store, this method overwrites the old rule list with the new content.

  • encodedContentRuleList:

    The JSON source for the new rule list. For information about how to format the JSON content, see Creating A Content Blocker.

  • completionHandler:

    A completion handler block to call after compilation finishes. This block has no return value and takes the following parameters:

    ruleList

    The Wkcontentrulelist object that encapsulates the compiled rules derived from the encodedContentRuleList parameter. This parameter is nil if an error occurs during compilation.

    error

    nil on success, or an error object if a problem occurred.

See Also

Creating and Deleting Content Rule Lists