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
692 B
Plaintext
31 lines
692 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 pages
|
|
}
|
|
|
|
init(from decoder: any Decoder) throws {
|
|
let container: KeyedDecodingContainer<Response.CodingKeys> = try decoder.container(keyedBy: Response.CodingKeys.self)
|
|
|
|
self.pages = try container.decode([Response.Page].self, forKey: Response.CodingKeys.pages)
|
|
|
|
}
|
|
|
|
func encode(to encoder: any Encoder) throws {
|
|
var container = encoder.container(keyedBy: Response.CodingKeys.self)
|
|
|
|
try container.encode(self.pages, forKey: Response.CodingKeys.pages)
|
|
}
|
|
}
|
|
|
|
|