<!--
{
  "documentType" : "article",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/String/UnicodeScalarView/BidirectionalCollection-Implementations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "BidirectionalCollection Implementations"
}
-->

# BidirectionalCollection Implementations

## Topics

### Instance Properties

[`var endIndex: String.UnicodeScalarView.Index`](/documentation/Swift/String/UnicodeScalarView/endIndex)

The “past the end” position—that is, the position one greater than
the last valid subscript argument.

[`var last: Self.Element?`](/documentation/Swift/String/UnicodeScalarView/last)

The last element of the collection.

[`var startIndex: String.UnicodeScalarView.Index`](/documentation/Swift/String/UnicodeScalarView/startIndex)

The position of the first Unicode scalar value if the string is
nonempty.

### Instance Methods

[`func difference<C>(from: C) -> CollectionDifference<Self.Element>`](/documentation/Swift/String/UnicodeScalarView/difference(from:))

Returns the difference needed to produce this collection’s ordered
elements from the given collection.

[`func difference<C>(from: C, by: (C.Element, Self.Element) -> Bool) -> CollectionDifference<Self.Element>`](/documentation/Swift/String/UnicodeScalarView/difference(from:by:))

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: String.UnicodeScalarView.Index, to: String.UnicodeScalarView.Index) -> Int`](/documentation/Swift/String/UnicodeScalarView/distance(from:to:))

Returns the distance between two indices.

[`func dropLast(Int) -> Self.SubSequence`](/documentation/Swift/String/UnicodeScalarView/dropLast(_:))

Returns a subsequence containing all but the specified number of final
elements.

[`func formIndex(before: inout Self.Index)`](/documentation/Swift/String/UnicodeScalarView/formIndex(before:))

Replaces the given index with its predecessor.

[`func index(String.UnicodeScalarView.Index, offsetBy: Int) -> String.UnicodeScalarView.Index`](/documentation/Swift/String/UnicodeScalarView/index(_:offsetBy:))

Returns an index that is the specified distance from the given index.

[`func index(String.UnicodeScalarView.Index, offsetBy: Int, limitedBy: String.UnicodeScalarView.Index) -> String.UnicodeScalarView.Index?`](/documentation/Swift/String/UnicodeScalarView/index(_:offsetBy:limitedBy:))

Returns an index that is the specified distance from the given index,
unless that distance is beyond a given limiting index.

[`func index(after: String.UnicodeScalarView.Index) -> String.UnicodeScalarView.Index`](/documentation/Swift/String/UnicodeScalarView/index(after:))

Returns the next consecutive location after `i`.

[`func index(before: String.UnicodeScalarView.Index) -> String.UnicodeScalarView.Index`](/documentation/Swift/String/UnicodeScalarView/index(before:))

Returns the previous consecutive location before `i`.

[`func last(where: (Self.Element) throws -> Bool) rethrows -> Self.Element?`](/documentation/Swift/String/UnicodeScalarView/last(where:))

Returns the last element of the sequence that satisfies the given
predicate.

[`func lastIndex(of: Self.Element) -> Self.Index?`](/documentation/Swift/String/UnicodeScalarView/lastIndex(of:))

Returns the last index where the specified value appears in the
collection.

[`func lastIndex(where: (Self.Element) throws -> Bool) rethrows -> Self.Index?`](/documentation/Swift/String/UnicodeScalarView/lastIndex(where:))

Returns the index of the last element in the collection that matches the
given predicate.

[`func reversed() -> ReversedCollection<Self>`](/documentation/Swift/String/UnicodeScalarView/reversed())

Returns a view presenting the elements of the collection in reverse
order.

[`func suffix(Int) -> Self.SubSequence`](/documentation/Swift/String/UnicodeScalarView/suffix(_:))

Returns a subsequence, up to the given maximum length, containing the
final elements of the collection.

### Subscripts

[`subscript(String.UnicodeScalarView.Index) -> Unicode.Scalar`](/documentation/Swift/String/UnicodeScalarView/subscript(_:)-2op53)

Accesses the Unicode scalar value at the given position.

[`subscript(Range<String.UnicodeScalarView.Index>) -> String.UnicodeScalarView.SubSequence`](/documentation/Swift/String/UnicodeScalarView/subscript(_:)-6aml8)

Accesses a contiguous subrange of the collection’s elements.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)