index(_:offsetBy:)
func index(_ i: Self.Index, offsetBy distance: Int) -> Self.Index
func index(_ i: Self.Index, offsetBy distance: Int) -> Self.Index
import Swift
protocol BidirectionalCollection<Element> : Collection where Self.Indices : BidirectionalCollection, Self.SubSequence : BidirectionalCollection
A collection that supports backward as well as forward traversal.
associatedtype Index : Comparable where Self.Index == Self.Indices.Element, Self.Indices.Element == Self.Indices.Index, Self.Indices.Index == Self.SubSequence.Index
A type that represents a position in the collection.
@frozen struct Int
A signed integer value type.
func index(_ i: Self.Index, offsetBy distance: Int) -> Self.Index
Returns an index that is the specified distance from the given index.
func index(_ i: Self.Index, offsetBy distance: Int) -> Self.Index
Returns an index that is the specified distance from the given index.
var last: Self.Element? { get }
The last element of the collection.
func difference<C>(from other: C, by areEquivalent: (C.Element, Self.Element) -> Bool) -> CollectionDifference<Self.Element> where C : BidirectionalCollection, Self.Element == C.Element
Returns the difference needed to produce this collection’s ordered elements from the given collection, using the given predicate as an equivalence test.
func distance(from start: Self.Index, to end: Self.Index) -> Int
func dropLast(_ k: Int) -> Self.SubSequence
Returns a subsequence containing all but the specified number of final elements.
func formIndex(before i: inout Self.Index)
func index(_ i: Self.Index, offsetBy distance: Int, limitedBy limit: Self.Index) -> Self.Index?
func last(where predicate: (Self.Element) throws -> Bool) rethrows -> Self.Element?
Returns the last element of the sequence that satisfies the given predicate.
func lastIndex(where predicate: (Self.Element) throws -> Bool) rethrows -> Self.Index?
Returns the index of the last element in the collection that matches the given predicate.
func reversed() -> ReversedCollection<Self>
Returns a view presenting the elements of the collection in reverse order.
func suffix(_ maxLength: Int) -> Self.SubSequence
Returns a subsequence, up to the given maximum length, containing the final elements of the collection.