Get the size of a dictionary

 Problem

I have a Dictionary and want to calculate its size/capacity (how many key-value pairs it contains).



 Recipe


// Initialize the Dictionary
var dict = ["name": "John", "surname": "Doe"]

// Get the size of the dictionary

let size = dict.count
print(size)
				


 Playground