[!NOTE] You need to use [key:value, ]
let Details: [String: String] = ["Name": "Girish", "age": "29"]
print(Details)
Details["Name"]
Details["FirstName"] //null --> Since the key is not present
Details["firstname"] = "Girish"
Update value
updateValue(value : forKey: <key>)
[!NOTE] This will return the previous value if not present it will return nil and then update the value
let previousLastName: String? = Details.updateValue("V", forKey: "lastname")
print("previous lastname \(previousLastName ?? "nil") and current value \(Details)")
removeValue(forkey:)
another way is by setting the value to
nil
Details.removeValue(forKey: "lastname")
Details["lastname"] = nil
Details.count
Details.keys
Array(Details.values)