SwiftyJSONSwift 的 JSON 開(kāi)發(fā)包
SwiftyJSON 可以讓你在 Swift 語(yǔ)言中更好的處理 JSON 數(shù)據(jù)。
示例代碼:
let jsonObject : AnyObject! = NSJSONSerialization.JSONObjectWithData(dataFromTwitter, options: NSJSONReadingOptions.MutableContainers, error: nil)
if let statusesArray = jsonObject as? NSArray{
if let aStatus = statusesArray[0] as? NSDictionary{
if let user = aStatus["user"] as? NSDictionary{
if let userName = user["name"] as? NSDictionary{
//Finally We Got The Name
}
}
}
}評(píng)論
圖片
表情
