Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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