Indexable

protocol Indexable
Inheritance View Protocol Hierarchy →
Associated Types
Index : ForwardIndexType

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 import Swift

Instance Variables

var endIndex: Self.Index Required

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 }
var startIndex: Self.Index Required

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

subscript(_: Self.Index) Required

Declaration

subscript(position: Self.Index) -> Self._Element { get }