Last active
April 5, 2017 18:33
-
-
Save kasimte/ee76e29a0abedc62051c39ac17d0c6f2 to your computer and use it in GitHub Desktop.
Example of Swift Type Casting Chaining
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: 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