Remove all items from dictionary

 Problem

I want to remove all elements from an existing dictionary.



 Recipe


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

dict.removeAll()

print(dict)
				

Heard the news?

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

 

 Playground