First, let’s create a Dictionary with two elements.
var myDictionary = ["first_name": "Sergey", "last_name": "Kargopolov"]
print(myDictionary)
Now we can add a new key with a value.
myDictionary["user_id"] = "f5h7ru0tJurY8f7g5s6fd"
We should now have 3 key-value pairs printed
print(myDictionary)
For more Swift code examples and tutorials, please check the Swift Code Examples page on this website.