Skip to content

Instance MethodFoundationEssentials

replaceSubrange(_:with:)

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
Replaces the contents in a range of the attributed string.
mutating func replaceSubrange(_ range: some RangeExpression<AttributedString.Index>, with s: some AttributedStringProtocol)

Parameters

range

The range of the attributed string to replace.

s

The string to insert in place of the replaced range.