replaceSelection(_:withCharacters:)
Replace the selection with new content, attributed with the typing attributes.
Declaration
mutating func replaceSelection(_ selection: inout AttributedTextSelection, withCharacters newContent: some Collection<Character>)Discussion
Operates just like replaceSelection(_:with:), but applies the typing attributes to the new content before inserting it.