AnyObject
может быть опущен в другие типы классов, поэтому существует множество возможностей!
//if you're confident that responseObject will definitely be of this dictionary type
let name = (responseObject as! [String : AnyObject])["name"]
//optional dictionary type
let name = (responseObject as? [String : AnyObject])?["name"]
//or unwrapping, name will be inferred as AnyObject
if let myDictionary = responseObject as? [String : AnyObject] {
let name = myDictionary["name"]
}
//or unwrapping, name will be inferred as String
if let myDictionary = responseObject as? [String : String] {
let name = myDictionary["name"]
}
Отъезд the reference. Есть даже раздел на AnyObject
Спасибо, это было полезно ... –