Last active
October 2, 2017 18:17
-
-
Save alicanbatur/a34573b466241a166708007229cc25a7 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
// Example JSON | |
{ | |
"name": "Ali", | |
"surname": "Batur", | |
"age": 29 | |
} | |
// Our model | |
struct Person { | |
var name: String? | |
var surname: String? | |
var age: Int? | |
} |
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
// If mapped into custom object, it will let you add your business or any other job into your model classes | |
let person = Person(dictionary: json) | |
label.title = person.name | |
// If not mapped, all other business jobs or anything else is about this person class will be here. Here? | |
if let title = dictionary["name"] as? String { | |
label.title = title | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment