Required Instance Methodswift 6.0.1Swift
index(before:)
Returns the position immediately before the given index.
override func index(before i: Self.Index) -> Self.Index
Parameters
- i
A valid index of the collection.
i
must be greater thanstartIndex
.
Returns
The index value immediately before i
.
Restates
func index(before: Self.Index
) -> Self.Index Returns the position immediately before the given index.
Other requirements
View members
Hide members
This section is hidden by default because it contains too many (15) members.
Type members
Instance members
var endIndex: Self.Index
var indices: Self.Indices
The indices that are valid for subscripting the collection, in ascending order.
var startIndex: Self.Index
subscript(Range<Self.Index>
) -> Self.SubSequence Accesses a contiguous subrange of the collection’s elements.
subscript(Self.Index
) -> Self.Element func distance(from: Self.Index, to: Self.Index
) -> Int Returns the distance between two indices.
func formIndex(after: inout Self.Index
) Replaces the given index with its successor.
func formIndex(before: inout Self.Index
) Replaces the given index with its predecessor.
func index(Self.Index, offsetBy: Int
) -> Self.Index Returns an index that is the specified distance from the given index.
func index(Self.Index, offsetBy: Int, limitedBy: Self.Index
) -> Self.Index? Returns an index that is the specified distance from the given index, unless that distance is beyond a given limiting index.
func index(after: Self.Index
) -> Self.Index Returns the position immediately after the given index.
Citizens in Swift
Default implementations
func index(before: Self.Index
) -> Self.Index Returns the position immediately after the given index.