Remove All Items From a Dictionary

Let’s create a Dictionary with two elements first.

var myDictionary = ["first_name": "Sergey", "last_name": "Kargopolov"]

Now we can remove all elements from a Dictionary.

myDictionary.removeAll()
print(myDictionary)

For more Swift code examples and tutorials, please check the Swift Code Examples page on this website.


Leave a Reply

Your email address will not be published. Required fields are marked *

Free Video Lessons

Enter your email and stay on top of things,

Subscribe!