swift对数据的Decodable

CodingKeys 可以对变量的名字可以修改,如果有CodingKeys 即使有的变量的名字没有修改,也要写在这个里边
struct AgreenResponseModel:Decodable {
    var totalN: String?
    var mTimeOut: String?
    var timeOutTitle:String?

    private enum CodingKeys: String, CodingKey {
        case mTimeOut = "timeOut"
        case totalN = "total"
        case timeOutTitle
    }
}

这个必须要写

你可能感兴趣的:(swift对数据的Decodable)