Skip to content

Instantly share code, notes, and snippets.

@edopelawi
Last active October 12, 2016 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edopelawi/f1c82db03fb8aab7aeff08078f7a5c93 to your computer and use it in GitHub Desktop.
Save edopelawi/f1c82db03fb8aab7aeff08078f7a5c93 to your computer and use it in GitHub Desktop.
A sample method on extracting a String from a Swift Dictionary.
/// Returns `String` optional representation of user's token from passed `json`.
func getUserToken(json: [String: AnyObject]) -> String? {
return json["user_token"] as? String
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment