Skip to content

Instantly share code, notes, and snippets.

@amolloy
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amolloy/592a7ae4eb8a8de4bf20 to your computer and use it in GitHub Desktop.
Save amolloy/592a7ae4eb8a8de4bf20 to your computer and use it in GitHub Desktop.
NSString* theId = jsonDict[@“response”][@“id”];, in Swift
let info : Dictionary<String, AnyObject!> = ...
var theId : String?
let reponseObj = info["response"]
if let response = reponseObj as? Dictionary<String, AnyObject!>
{
let idObj = response["id"]
if let id = idObj as? String
{
theId = id
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment