Last active
March 24, 2020 17:06
-
-
Save KarenK1995/2b5cc131fe0d29e23b224e2d3ccd3f64 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: Codable { | |
let name: String | |
let surname: String | |
let age: Int | |
} | |
let user = User(name: "John", surname: "Smith", age: 18) | |
do { | |
let userData = try JSONEncoder().encode(user) | |
} | |
catch { | |
print(error) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment