С учетом классов:
class ComplementApp: Codable{
let name: String
let idSpring: String
}
class MasterClass: Encodable{
let complement: ComplementApp
///Other propierties
}
Я хочу получить:
//Where "Some ID" is the value of complement.idSpring
{
complement: "Some ID"
//Plus the other properties
}
Не
{
complement: {
name: "Some Name",
idSpring: "Some ID"
}
//Plus other properties
}
По умолчанию. Я знаю, что я могу сделать это, бросить функцию кодирования и CodingKeys в MasterClass, но у меня есть, как 20 других переменных, и я должен добавить 19 дополнительных ключей. Могу ли я добиться реализации CodingKeys в ComplementApp?