I am stuck on this code! I want to remove the optionals what is the best way to do that? I tried to change the AnyObject in to NSString but I don't know how.
What is the best way to do this?
And my second question is how do I store this in the core data? Is there a cool framework for this?
Alamofire.request(.GET, urlDb)
.responseJSON { (request, response, json, error) in
println(error)
//println(json)
if let contactGroups : AnyObject! = json{
//println("Contact groepen")
var contactGroups = contactGroups["contact_groups"] as NSArray
for cG in contactGroups {
println(cG["group_id"]!)
//println(cG["contact_id"]!)
}
}
if let contacts : AnyObject = json{
//println(contacts["contacts"])
println("Contacten")
var contacts = contacts["contacts"] as NSArray
for c in contacts{
println(c["id"])
println(c["name"])
}
}
}
This is the console log
nil
Optional(1)
Optional(2)
Contacten
Optional(1)
Optional(Dirk Sierd de Vries)
I hope you guys can help me with my school project :D