Instance Method

insert(_:at:)

Inserts the characters and attributes of the given attributed string into the receiver at the given index.

Declaration

func insert(_ attrString: NSAttributedString, at loc: Int)

Parameters

attributedString

The string whose characters and attributes are inserted.

index

The index at which the characters and attributes are inserted.

Discussion

The new characters and attributes begin at the given index and the existing characters and attributes from the index to the end of the receiver are shifted by the length of the attributed string. Raises an rangeException if index lies beyond the end of the receiver’s characters.

See Also

Changing characters and attributes

func append(NSAttributedString)

Adds the characters and attributes of a given attributed string to the end of the receiver.

func replaceCharacters(in: NSRange, with: NSAttributedString)

Replaces the characters and attributes in a given range with the characters and attributes of the given attributed string.

func setAttributedString(NSAttributedString)

Replaces the receiver’s entire contents with the characters and attributes of the given attributed string.