Get the size of a dictionary


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


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

// Get the size of the dictionary

let size = dict.count

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)