Last active
July 18, 2020 07:54
-
-
Save sajjadsarkoobi/cb032fae96682ebc70f087af2d16cf12 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_Model:Codable { | |
var fullName:AnyCodableValue? | |
var age:AnyCodableValue? | |
var point:AnyCodableValue? | |
var isVerified:AnyCodableValue? | |
init(from decoder: Decoder) throws { | |
let container = try decoder.container(keyedBy: CodingKeys.self) | |
self.fullName = try container.decodeIfPresent(AnyCodableValue.self, forKey: .fullName) | |
self.age = try container.decodeIfPresent(AnyCodableValue.self, forKey: .age) | |
self.point = try container.decodeIfPresent(AnyCodableValue.self, forKey: .point) | |
self.isVerified = try container.decodeIfPresent(AnyCodableValue.self, forKey: .isVerified) | |
} | |
init(){ | |
self.fullName = .string("") | |
self.age = .integer(0) | |
self.point = .double(0) | |
self.isVerified = .boolean(false) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment