Contents

popFirst()

Removes and returns the first key-value pair of the dictionary if the dictionary isn’t empty.

Declaration

mutating func popFirst() -> Dictionary<Key, Value>.Element?

Return Value

The first key-value pair of the dictionary if the dictionary is not empty; otherwise, nil.

Discussion

The first element of the dictionary is not necessarily the first element added. Don’t expect any particular ordering of key-value pairs.

See Also

Excluding Elements