lundi 21 novembre 2016

Swift Reflection mapping attributes

Are there anything look like java reflection in swift or I have to always map one by one attribute like following code?

class User: Model {

var name: String

override init(data: Dictionary<String, AnyObject>){
    super.init(data: data)
    self.name = data["name"] as? String
    if let vouchers_count = data["vouchers_count"] as? Int {
        self.vouchers_count = vouchers_count
    }
}





Aucun commentaire:

Enregistrer un commentaire