mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
* Support extensions including conditional conformance * Correct access modifiers * More correct lookup for the synthesized declarations * Avoid printing decls in nested types (rdar://98025945)
31 lines
787 B
Plaintext
31 lines
787 B
Plaintext
struct Response: Codable {
|
|
let pages: [Page]
|
|
|
|
struct Page: Codable {
|
|
let results: [Result]
|
|
|
|
struct Result: Codable {
|
|
let title: String
|
|
|
|
private enum CodingKeys: CodingKey {
|
|
case title
|
|
}
|
|
|
|
init(from decoder: any Decoder) throws {
|
|
let container: KeyedDecodingContainer<Response.Page.Result.CodingKeys> = try decoder.container(keyedBy: Response.Page.Result.CodingKeys.self)
|
|
|
|
self.title = try container.decode(String.self, forKey: Response.Page.Result.CodingKeys.title)
|
|
|
|
}
|
|
|
|
func encode(to encoder: any Encoder) throws {
|
|
var container = encoder.container(keyedBy: Response.Page.Result.CodingKeys.self)
|
|
|
|
try container.encode(self.title, forKey: Response.Page.Result.CodingKeys.title)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|