Created
November 9, 2019 17:09
-
-
Save wadheraswati/df0b3ac4ab3f35ad9c11f8bba457b64b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct User: Encodable { | |
let id: Int | |
let name: Encodable | |
let address: Address | |
enum CodingKeys: String, CodingKey { | |
case id | |
case name | |
} | |
} | |
struct Address: Encodable { | |
let id: Int | |
let address: String | |
let city: String | |
let state: String | |
let country: String | |
enum CodingKeys: String, CodingKey { | |
case id | |
case address | |
case city | |
case state | |
case country | |
} | |
} | |
let address = Address(id: 1, | |
address: "House no. 123", | |
city: "New Delhi", | |
state: "Delhi", | |
country: "India") | |
let user = User(id: 1, | |
name: "John", | |
address: address) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment