A Boolean value that indicates whether the dictionary is empty.
SDK
- Xcode 10.0+
Framework
- Swift Standard Library
Declaration
var isEmpty: Bool { get }
Discussion
Dictionaries are empty when created with an initializer or an empty dictionary literal.
var frequencies: [String: Int] = [:]
print(frequencies.isEmpty)
// Prints "true"