This file contains hidden or 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 DummyInfo: Codable { } | |
| struct User: Codable { | |
| let username: String | |
| var registrationInfo: RegistrationInfo? | |
| var preference: PreferenceInfo? | |
| private enum CodingKeys: String, CodingKey { | |
| case username | |
| case additionalInfo = "additional_info" |
This file contains hidden or 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 username: String | |
| let additionalInfo: [AdditionalInfo] | |
| } | |
| struct RegistrationInfo: AdditionalInfo {} | |
| struct PreferenceInfo: AdditioinalInfo {} |
This file contains hidden or 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 username: String | |
| var registrationInfo: RegistrationInfo? | |
| var preference: PreferenceInfo? | |
| } |
This file contains hidden or 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
| { | |
| "username": "Test user", | |
| "additional_info": [ | |
| { | |
| "registration_time": "01/01/2017", | |
| "registration_device": "iPhone 6", | |
| "registration_ip": "1.2.3.4" | |
| }, | |
| { | |
| "some_random_info": "XXXX" |
This file contains hidden or 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 Coordinate: Codable { | |
| let latitude: Double | |
| let longitude: Double | |
| let elevation: Double | |
| let hasGoogleMap: Bool | |
| private enum CodingKeys: String, CodingKey { | |
| case latitude | |
| case longitude | |
| case additionalInfo = "additional_info" |
This file contains hidden or 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
| { | |
| "latitude": 12.0, | |
| "longitude": 13.0, | |
| "additional_info": { | |
| "elevation": 456, | |
| "has_google_map": false | |
| } | |
| } |
This file contains hidden or 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
| let decoder = JSONDecoder() | |
| let user = try! decoder.decode(User.self, from: json) | |
| let encoder = JSONEncoder() | |
| let jsonData = try! encoder.encode(user) | |
| print(String(data: jsonData, encoding: .utf8)!) |
This file contains hidden or 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 Country: Codable { | |
| let countryName: String | |
| let countryCode: String | |
| private enum CodingKeys: String, CodingKey { | |
| case countryName = "name" | |
| case countryCode = "code" | |
| } | |
| } |
This file contains hidden or 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
| { | |
| "username": "Test user", | |
| "country": { | |
| "name": "United States", | |
| "code": "US" | |
| }, | |
| "type": 2 | |
| } |
This file contains hidden or 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
| <script type="text/javascript" | |
| src="http://www.google.com/recaptcha/api/challenge?k=your_public_key"> | |
| </script> | |
| <noscript> | |
| <iframe src="http://www.google.com/recaptcha/api/noscript?k=your_public_key" | |
| height="300" width="500" frameborder="0"></iframe><br> | |
| <textarea name="recaptcha_challenge_field" rows="3" cols="40"> | |
| </textarea> | |
| <input type="hidden" name="recaptcha_response_field" | |
| value="manual_challenge"> |
NewerOlder