Skip to content

Instantly share code, notes, and snippets.

@nderkach
Created September 18, 2018 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nderkach/a783a72be0fda015e946d4ad6d849909 to your computer and use it in GitHub Desktop.
Save nderkach/a783a72be0fda015e946d4ad6d849909 to your computer and use it in GitHub Desktop.
typealias BlockerList = [[String: [String: String]]]
private static func generateBlacklistJSON(from trackerList: [String]) -> BlockerList {
var blacklist: BlockerList = []
for tracker in trackerList {
blacklist.append([
"action": ["type": "block"],
"trigger": ["url-filter": String(format: "https?://(www.)?%@.*", tracker)]
])
}
return blacklist
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment