Instance Method
replaceSubrange(_:with:)
iOS 8.0+
iPadOS 8.0+
Mac Catalyst 8.0+
macOS 10.10+
tvOS 9.0+
watchOS 2.0+
Replaces a region of bytes in the data with new bytes from a collection.
@abi(func repalceSubrangeFast(_ subrange: Range<Data.Index>, with newElements: some Collection<UInt8>)) mutating func replaceSubrange(_ subrange: Range<Data.Index>, with newElements: some Collection<UInt8>)
Parameters
subrangeThe range in the data to replace.
newElementsThe replacement bytes.
Discussion
This will resize the data if required, to fit the entire contents of newElements.
Precondition
The bounds of subrange must be valid indices of the collection.