Skip to content

Instantly share code, notes, and snippets.

@alicanbatur
Last active October 2, 2017 18:17
Show Gist options
  • Save alicanbatur/a34573b466241a166708007229cc25a7 to your computer and use it in GitHub Desktop.
Save alicanbatur/a34573b466241a166708007229cc25a7 to your computer and use it in GitHub Desktop.
// Example JSON
{
"name": "Ali",
"surname": "Batur",
"age": 29
}
// Our model
struct Person {
var name: String?
var surname: String?
var age: Int?
}
// 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