Skip to content

Instantly share code, notes, and snippets.

@owensd
Created June 18, 2014 07:11
Show Gist options
  • Select an option

  • Save owensd/c42d3bd7b8ac4561d12a to your computer and use it in GitHub Desktop.

Select an option

Save owensd/c42d3bd7b8ac4561d12a to your computer and use it in GitHub Desktop.
if let dict = json as? NSDictionary {
if let blogs = dict["blogs"] as? Dictionary<String, AnyObject> {
if let blogItems : AnyObject = blogs["blog"] {
if let collection = blogItems as? Array<AnyObject> {
for blog : AnyObject in collection {
if let blogInfo = blog as? Dictionary<String, AnyObject> {
let id : AnyObject? = blogInfo["id"]
let name : AnyObject? = blogInfo["name"]
let needspassword : AnyObject? = blogInfo["needspassword"]
let url : AnyObject? = blogInfo["url"]
println("Blog ID: \(id)")
println("Blog Name: \(name)")
println("Blog Needs Password: \(needspassword)")
println("Blog URL: \(url)")
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment