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

# RangeReplaceableCollection Implementations

## Topics

### Operators

[`static func + <Other>(Other, Self) -> Self`](/documentation/Swift/Substring/UnicodeScalarView/+(_:_:)-1c1pd)

Creates a new collection by concatenating the elements of a sequence and a
collection.

[`static func + <Other>(Self, Other) -> Self`](/documentation/Swift/Substring/UnicodeScalarView/+(_:_:)-1p67y)

Creates a new collection by concatenating the elements of two collections.

[`static func + <Other>(Self, Other) -> Self`](/documentation/Swift/Substring/UnicodeScalarView/+(_:_:)-9qjws)

Creates a new collection by concatenating the elements of a collection and
a sequence.

[`static func += <Other>(inout Self, Other)`](/documentation/Swift/Substring/UnicodeScalarView/+=(_:_:))

Appends the elements of a sequence to a range-replaceable collection.

### Initializers

[`init()`](/documentation/Swift/Substring/UnicodeScalarView/init())

Creates a new, empty collection.

[`init<S>(S)`](/documentation/Swift/Substring/UnicodeScalarView/init(_:))

Creates a new instance of a collection containing the elements of a
sequence.

[`init(repeating: Self.Element, count: Int)`](/documentation/Swift/Substring/UnicodeScalarView/init(repeating:count:))

Creates a new collection containing the specified number of a single,
repeated value.

### Instance Methods

[`func append(Self.Element)`](/documentation/Swift/Substring/UnicodeScalarView/append(_:))

Adds an element to the end of the collection.

[`func append<S>(contentsOf: S)`](/documentation/Swift/Substring/UnicodeScalarView/append(contentsOf:))

Adds the elements of a sequence or collection to the end of this
collection.

[`func applying(CollectionDifference<Self.Element>) -> Self?`](/documentation/Swift/Substring/UnicodeScalarView/applying(_:))

Applies the given difference to this collection.

[`func filter<E>((Self.Element) throws(E) -> Bool) throws(E) -> Self`](/documentation/Swift/Substring/UnicodeScalarView/filter(_:)-6e5i2)

Returns a new collection of the same type containing, in order, the
elements of the original collection that satisfy the given predicate.

[`func insert(Self.Element, at: Self.Index)`](/documentation/Swift/Substring/UnicodeScalarView/insert(_:at:))

Inserts a new element into the collection at the specified position.

[`func insert<C>(contentsOf: C, at: Self.Index)`](/documentation/Swift/Substring/UnicodeScalarView/insert(contentsOf:at:))

Inserts the elements of a sequence into the collection at the specified
position.

[`func popLast() -> Self.Element?`](/documentation/Swift/Substring/UnicodeScalarView/popLast()-46voy)

Removes and returns the last element of the collection.

[`func popLast() -> Self.Element?`](/documentation/Swift/Substring/UnicodeScalarView/popLast()-7zgh4)

Removes and returns the last element of the collection.

[`func remove(at: Self.Index) -> Self.Element`](/documentation/Swift/Substring/UnicodeScalarView/remove(at:))

Removes and returns the element at the specified position.

[`func removeAll(keepingCapacity: Bool)`](/documentation/Swift/Substring/UnicodeScalarView/removeAll(keepingCapacity:))

Removes all elements from the collection.

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

Removes all the elements that satisfy the given predicate.

[`func removeFirst() -> Self.Element`](/documentation/Swift/Substring/UnicodeScalarView/removeFirst()-2a3ja)

Removes and returns the first element of the collection.

[`func removeFirst() -> Self.Element`](/documentation/Swift/Substring/UnicodeScalarView/removeFirst()-5t2ib)

Removes and returns the first element of the collection.

[`func removeFirst(Int)`](/documentation/Swift/Substring/UnicodeScalarView/removeFirst(_:)-2lfkb)

Removes the specified number of elements from the beginning of the
collection.

[`func removeFirst(Int)`](/documentation/Swift/Substring/UnicodeScalarView/removeFirst(_:)-5314w)

Removes the specified number of elements from the beginning of the
collection.

[`func removeLast() -> Self.Element`](/documentation/Swift/Substring/UnicodeScalarView/removeLast()-3izvn)

Removes and returns the last element of the collection.

[`func removeLast() -> Self.Element`](/documentation/Swift/Substring/UnicodeScalarView/removeLast()-75qy7)

Removes and returns the last element of the collection.

[`func removeLast(Int)`](/documentation/Swift/Substring/UnicodeScalarView/removeLast(_:)-30fw5)

Removes the specified number of elements from the end of the
collection.

[`func removeLast(Int)`](/documentation/Swift/Substring/UnicodeScalarView/removeLast(_:)-74qgu)

Removes the specified number of elements from the end of the
collection.

[`func removeSubrange<R>(R)`](/documentation/Swift/Substring/UnicodeScalarView/removeSubrange(_:)-2qm37)

Removes the elements in the specified subrange from the collection.

[`func removeSubrange(Range<Self.Index>)`](/documentation/Swift/Substring/UnicodeScalarView/removeSubrange(_:)-5c1al)

Removes the elements in the specified subrange from the collection.

[`func removeSubranges(RangeSet<Self.Index>)`](/documentation/Swift/Substring/UnicodeScalarView/removeSubranges(_:))

Removes the elements at the given indices.

[`func replaceSubrange<C>(Range<Substring.UnicodeScalarView.Index>, with: C)`](/documentation/Swift/Substring/UnicodeScalarView/replaceSubrange(_:with:))

Replaces the specified subrange of elements with the given collection.

[`func replaceSubrange<C>(Range<Self.Index>, with: C)`](/documentation/Swift/Substring/UnicodeScalarView/replaceSubrange(_:with:)-4kmx6)

Replaces the specified subrange of elements with the given collection.

[`func replaceSubrange<C, R>(R, with: C)`](/documentation/Swift/Substring/UnicodeScalarView/replaceSubrange(_:with:)-7xjpm)

Replaces the specified subrange of elements with the given collection.

[`func reserveCapacity(Int)`](/documentation/Swift/Substring/UnicodeScalarView/reserveCapacity(_:))

Prepares the collection to store the specified number of elements, when
doing so is appropriate for the underlying type.

---

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)