{"id":20168663,"url":"https://github.com/duckduckgo/trackerradarkit","last_synced_at":"2025-04-10T01:53:41.221Z","repository":{"id":38339450,"uuid":"330575300","full_name":"duckduckgo/TrackerRadarKit","owner":"duckduckgo","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-14T01:33:36.000Z","size":773,"stargazers_count":12,"open_issues_count":1,"forks_count":11,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-03-24T03:35:01.531Z","etag":null,"topics":["duckduckgo"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/duckduckgo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-18T06:29:13.000Z","updated_at":"2025-03-14T01:33:38.000Z","dependencies_parsed_at":"2025-02-27T17:36:16.733Z","dependency_job_id":"0876449d-ef6f-431b-88d6-114ce5551698","html_url":"https://github.com/duckduckgo/TrackerRadarKit","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duckduckgo%2FTrackerRadarKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duckduckgo%2FTrackerRadarKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duckduckgo%2FTrackerRadarKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duckduckgo%2FTrackerRadarKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/duckduckgo","download_url":"https://codeload.github.com/duckduckgo/TrackerRadarKit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142939,"owners_count":21054671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["duckduckgo"],"created_at":"2024-11-14T01:09:07.542Z","updated_at":"2025-04-10T01:53:41.197Z","avatar_url":"https://github.com/duckduckgo.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TrackerRadarKit\n\n## We are hiring!\n\nDuckDuckGo is growing fast and we continue to expand our fully distributed team. We embrace diverse perspectives, and seek out passionate, self-motivated people, committed to our shared vision of raising the standard of trust online. If you are a senior software engineer capable in either iOS or Android, visit our [careers](https://duckduckgo.com/hiring/#open) page to find out more about our openings!\n\n## Building\n\n`TrackerRadarKit` has one explicit dependency (https://github.com/apple/swift-argument-parser) that is automatically resolved when installing the swift package in Xcode. It can be added to an Xcode project as a swift package dependency or be used as an imported Swift package.\n\nIt can be built manually two ways:\n\n1. Build the  `TrackerRadarKit` scheme by opening the Swift package in Xcode\n2. Run `swift build -c release` to build a release binary\n\n### SwiftLint\n\nWe use [SwiftLint](https://github.com/realm/SwiftLint) for enforcing Swift style and conventions, so you'll need to [install it](https://github.com/realm/SwiftLint#installation).\n\n### Validator\n\nThe Validator tool can be used to validate that Tracker Radar data can be parsed, transformed and compiled by WebKit's content rule list store.   As such, it requires macos 10.13 to run.\n\nTo build, check out the code and run from the project root:\n* `swift build`\n\nTo run, execute the following from the project root:\n* `.build/debug/Validator`\n\n## Installation\n\nWe recommend the use of [Swift Package Manager](https://www.swift.org/package-manager/) \n\n## How to block trackers\n\n\nIn order to block content on the web view you need to [compile](https://developer.apple.com/documentation/webkit/wkcontentruleliststore/2902761-compilecontentrulelist/) a content rule list using  Apple's [WKContentRuleListStore](https://developer.apple.com/documentation/webkit/wkcontentruleliststore), then apply the compiled rule list to [WKUserContentController](https://developer.apple.com/documentation/webkit/wkusercontentcontroller).\n\nTrackerRadarKit allows you to generate this list using DuckDuckGo's [Tracker Radar](https://github.com/duckduckgo/tracker-radar) as source.\nThe main structs you'll need to use to create a content rule lists are:\n\n* [TrackerData](https://github.com/duckduckgo/TrackerRadarKit/blob/main/Sources/TrackerRadarKit/TrackerData.swift) -  Tracker Radar [JSON file](https://staticcdn.duckduckgo.com/trackerblocking/v2.1/tds.json) encoded format;\n\n* [ContentBlockerRulesBuilder](https://github.com/duckduckgo/TrackerRadarKit/blob/main/Sources/TrackerRadarKit/ContentBlockerRulesBuilder.swift) - uses  TrackerData to generate a list of [ContentBlockerRules](https://github.com/duckduckgo/TrackerRadarKit/blob/main/Sources/TrackerRadarKit/ContentBlockerRule.swift) which can be encoded as a JSON source for the new rule list. To find more about the content rule list specifications, please visit [Apple's documentation](https://developer.apple.com/documentation/safariservices/creating_a_content_blocker).\n\n\n### Example\n```swift\nlet trackerData: TrackerData = ...\nlet allowList: [String] = ...\n\nlet blockerBuilder = ContentBlockerRulesBuilder(trackerData: trackerData)\nlet rules = blockerBuilder.buildRules(withExceptions: allowList)\n\nlet data: Data\n\ndo {\n    data = try JSONEncoder().encode(rules)\n} catch {\n    // Handle Error\n}\n\nlet ruleList = String(data: data, encoding: .utf8)\n```\n\n## License\n\nDuckDuckGo is distributed under the Apache 2.0 [license](https://github.com/duckduckgo/ios/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduckduckgo%2Ftrackerradarkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fduckduckgo%2Ftrackerradarkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduckduckgo%2Ftrackerradarkit/lists"}