Skip to content

Instantly share code, notes, and snippets.

@kasimte
Last active April 5, 2017 18:33
Show Gist options
  • Save kasimte/ee76e29a0abedc62051c39ac17d0c6f2 to your computer and use it in GitHub Desktop.
Save kasimte/ee76e29a0abedc62051c39ac17d0c6f2 to your computer and use it in GitHub Desktop.
Example of Swift Type Casting Chaining
//: Playground - noun: a place where people can play
var dict = [ "user" : ["attribute" : "attribute_value"] ]
if let d = dict as? [String : AnyObject],
let user_d = d["user"] as? [String : String] {
print(user_d)
} else {
print("Didn't work.")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment