Removes and returns the key-value pair at the specified index.
SDK
- Xcode 8.3+
Framework
- Swift Standard Library
Declaration
@discardableResult mutating func remove(at index: Dictionary<Key, Value>.Index) -> Dictionary<Key, Value>.Element
Parameters
indexThe position of the key-value pair to remove.
indexmust be a valid index of the dictionary, and must not equal the dictionary’s end index.
Return Value
The key-value pair that correspond to index.
Discussion
Calling this method invalidates any existing indices for use with this dictionary.
Complexity: O(n), where n is the number of key-value pairs in the dictionary.