Contents

replaceContents(in:with:)

Replaces the characters specified by range with the text elements you provide.

Declaration

func replaceContents(in range: NSTextRange, with textElements: [NSTextElement]?)

Parameters

  • range:

    An Nstextrange.

  • textElements:

    The elements to replace that characters at range.

Discussion

If the edges of range aren’t at existing element range boundaries, the method either splits the element if it allows the operation (for example, NSTextParagraph), or the adjusts the replacement range.

See Also

Accessing and updating the text