Swift Add Elements To A Dictionary

[Solved] Swift Add Elements To A Dictionary | Swift - Code Explorer | yomemimo.com
Question : append new element to dictionary in swift

Answered by : muhammad-zeeshan-vdbiet6jzy1z

var dict = [1: "abc", 2: "cde"] // dict is of type Dictionary<Int, String>
dict[3] = "efg"

Source : | Last Update : Thu, 03 Mar 22

Question : Swift Add Elements to a Dictionary

Answered by : samer-saeid

var capitalCity = ["Nepal": "Kathmandu", "England": "London"]
print("Initial Dictionary: ",capitalCity)
capitalCity["Japan"] = "Tokyo"
print("Updated Dictionary: ",capitalCity)
print(capitalCity["Japan"])

Source : | Last Update : Thu, 23 Jun 22

Answers related to swift add elements to a dictionary

Code Explorer Popular Question For Swift