Contents

WKContentRuleList

A compiled list of rules to apply to web content.

Declaration

@MainActor class WKContentRuleList

Overview

A WKContentRuleList object represents a compiled set of rules for modifying how a webpage loads content. You don’t create a WKContentRuleList directly. Instead, you specify your rules in JSON format and compile them using the compileContentRuleList(forIdentifier:encodedContentRuleList:completionHandler:) method of WKContentRuleListStore. That method compiles your rules into an efficient byte format and returns them in an instance of this class.

Content rule lists use the same syntax as content blocker extensions in Safari. For more information on how to specify the JSON for your rule lists, see Creating a content blocker.

Topics

Getting the Rules List Identifier

See Also

Adding and Removing Content Rules