Created
August 1, 2014 14:48
-
-
Save alexkent/4c71578ad2e0e4e58923 to your computer and use it in GitHub Desktop.
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
var iExist:String? | |
var s:[String:Any] = [String:Any]() | |
s["thing"] = 2 | |
if let x = s["thing"] { | |
iExist = x | |
} | |
// explicit cast x | |
if let x:String = s["thing"] { | |
iExist = x | |
} | |
// which leaves me with | |
if let x:String = s["thing"] as? String { | |
iExist = x | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment