Created
September 12, 2016 14:33
-
-
Save anonymous/7f5b592a3b7816007bdfc86ce479f473 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
if let json = jsonOptional as? Dictionary<String, AnyObject> { | |
if let id = json["id"] as AnyObject? as? Int { // Currently in beta 5 there is a bug that forces us to cast to AnyObject? first | |
if let name = json["name"] as AnyObject? as? String { | |
if let email = json["email"] as AnyObject? as? String { | |
let user = User(id: id, name: name, email: email) | |
callback(user) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment