Contents

remove(at:)

Removes and returns the key-value pair at the specified index.

Declaration

@discardableResult mutating func remove(at index: Dictionary<Key, Value>.Index) -> Dictionary<Key, Value>.Element

Parameters

  • index:

    The position of the key-value pair to remove. index must 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.

See Also

Removing Keys and Values