Accesses the element at the specified position.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
Parameters
position
The position of the element to access.
position
must be a valid index of the collection that is not equal to theend
property.Index
Discussion
For example, you can replace an element of an array by using its subscript.
You can subscript a collection with any valid index other than the collection’s end index. The end index refers to the position one past the last element of a collection, so it doesn’t correspond with an element.
Complexity: O(1)
Note
This documentation comment was inherited from Mutable
.