protocol
Indexable
Inheritance | View Protocol Hierarchy → |
---|---|
Associated Types |
A type that represents a valid position in the collection. Valid indices consist of the position of every element and a "past the end" position that's not valid for use as a subscript. |
Import |
|
Instance Variables
The collection's "past the end" position.
endIndex
is not a valid argument to subscript
, and is always
reachable from startIndex
by zero or more applications of
successor()
.
Complexity: O(1)
Declaration
var
endIndex
:
Self
.
Index
{
get
}
The position of the first element in a non-empty collection.
In an empty collection, startIndex == endIndex
.
Complexity: O(1)
Declaration
var
startIndex
:
Self
.
Index
{
get
}
Subscripts
Returns the element at the given position
.
Complexity: O(1)
Declaration
subscript
(
position
:
Self
.
Index
) -
>
Self
.
_Element
{
get
}
A type that provides subscript access to its elements.
Important: In most cases, it's best to ignore this protocol and use
CollectionType
instead, as it has a more complete interface.