swift 4 Decodable 协议如何与“ - ”字母一起使用?例如:
[{
"trigger": {
"url-filter": "webkit.org",
"resource-type": ["image"]
},
"action": {
"selector": "#logo",
"type": "block"
}
}]
在我的 Swift 课程中:
struct blockerJson : Decodable {
let action : action
let trigger : trigger
struct action : Decodable {
let selector : String
let type : String
}
struct trigger : Decodable {
let urlFilter : String
let resourceType : String
}
}
不知道怎么改class,但是json不能改...