Skip to content

Instantly share code, notes, and snippets.

@ycui1
Last active December 28, 2019 16:10
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 ycui1/f92f346e6af914ddffd817aa03754329 to your computer and use it in GitHub Desktop.
Save ycui1/f92f346e6af914ddffd817aa03754329 to your computer and use it in GitHub Desktop.
// instantiate a dictionary
var personalInfo = ["firstName": "John", "address": "1100 Main St."]
// data retrieval
let firstName = personalInfo["firstName"]
let middleName = personalInfo["middleName"]
// data insertion
personalInfo["lastName"] = "Smith"
personalInfo["firstName"] = "Mike"
// data deletion
let deletedAddress = personalInfo.removeValue(forKey: "address")
let deletedMiddleName = personalInfo.removeValue(forKey: "middleName")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment