Swift - Checking the Size of a Dictionary

Introduction

To get the number of items within a dictionary, use the count property which is read-only:

Demo

var myTable =  [
    "Apple": "iOS",
    "Google" : "Android",
    "Microsoft" : "Windows Phone"
]

print(myTable.count)  //3

Result

Related Topic