---
title: "compileContentRuleList(forIdentifier:encodedContentRuleList:completionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkcontentruleliststore/compilecontentrulelist(foridentifier:encodedcontentrulelist:completionhandler:)"
---

# compileContentRuleList(forIdentifier:encodedContentRuleList:completionHandler:)

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

## Declaration

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

```swift
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 doc://com.apple.documentation/documentation/SafariServices/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:

## See Also

### Creating and Deleting Content Rule Lists

- [removeContentRuleList(forIdentifier:completionHandler:)](webkit/wkcontentruleliststore/removecontentrulelist(foridentifier:completionhandler:).md)
