更新时间:2022-04-24 00:35:46
您可以使用字典进行解码:用户组合然后提取出用户对象.例如
You could decode using a dictionary: user combination then extract out the user object. e.g.
struct User: Codable {
let id: Int
let username: String
}
let decoder = JSONDecoder()
let userDictionary = try decoder.decode([String: User].self, from: jsonData)