[Solved] Why isEmpty not working here ?


A struct with two generic placeholder types ≠ dictionary.

If you need a dictionary, then create an instance of a dictionary like so:

var dictionaryInstance = [Int: String]()

isEmpty works now:

print(dictionaryInstance.isEmpty) // true

You can also create a typealias:

typealias MyDictionary = [Int: String]

var myDictionaryInstance = MyDictionary()

2

solved Why isEmpty not working here ?