Skip to content

Instantly share code, notes, and snippets.

@kulte
Created October 14, 2014 21:56
Show Gist options
  • Save kulte/ee6eca6eabe201da1033 to your computer and use it in GitHub Desktop.
Save kulte/ee6eca6eabe201da1033 to your computer and use it in GitHub Desktop.
Swift is very strict about types
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
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment