Instance Property

isEmpty

A Boolean value that indicates whether the dictionary is empty.

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"

Relationships

From Protocol

See Also

Inspecting a Dictionary

var count: Int

The number of key-value pairs in the dictionary.

var capacity: Int

The total number of key-value pairs that the dictionary can contain without allocating new storage.