Removes and returns the first key-value pair of the dictionary if the dictionary isn’t empty.
SDK
- Xcode 8.0+
Framework
- Swift Standard Library
Declaration
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.
Complexity: Averages to O(1) over many calls to pop
.