Ind.ie is now Small Technology Foundation.
Commit ab795c77 authored by Aral Balkan's avatar Aral Balkan

Update debug text; add readme

parent f69c70ab
Pipeline #705 failed with stages
......@@ -46,7 +46,23 @@ class ViewController: UIViewController {
let rulesDecoder = JSONDecoder()
do {
let rules = try rulesDecoder.decode([ContentBlockerRule].self, from: rulesData)
print(rules)
for rule in rules {
let urlFilter = rule.trigger.urlFilter.replacingOccurrences(of: "^[^:]+://+([^:/]+\\.)?", with: "(any)")
let type = rule.action.type
var details: String = ""
if type == "css-display-none" {
if let selector = rule.action.selector {
details = "→ \(selector)"
} else {
details = "Error: no selector."
}
}
print ("[\(type)]\t\(urlFilter)\t\(details)")
}
} catch {
print(error)
}
......
# JSON Parsing Spike
## Goals
* Explore Swift 4 JSON parsing
* Parse blockerList.json
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment