alicanbatur
10/2/2017 - 1:48 PM

mapping-model

// 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
}
// Example JSON
{
  "name": "Ali",
  "surname": "Batur",
  "age": 29
}

// Our model
struct Person {
    var name: String?
    var surname: String?
    var age: Int?
}