在 swift4 中使用 JSONDecodable 时出现以下错误。"Type UserRegister does not confirm to protocol 'Decodable' "
我的模型结构看起来像这样。
struct UserRegister: Decodable {
let id : NSInteger
let name : String?
let email : String?
let cities : Array<Any>?
let tax : [tax]
let username : [username]
}
struct tax : Decodable {
let deviceId : NSInteger?
let financialYear : String?
let country : String?
let name : String?
let state : String?
let taxCode : String?
let value : NSInteger?
}
struct username : Decodable {
let email : String?
let phone : String?
}