Contents

addTemporaryAttributes(_:forCharacterRange:)

Appends one or more temporary attributes to the attributes dictionary of the specified character range.

Declaration

func addTemporaryAttributes(_ attrs: [NSAttributedString.Key : Any] = [:], forCharacterRange charRange: NSRange)

Parameters

  • attrs:

    Attributes dictionary containing the temporary attributes to add.

  • charRange:

    The range of characters to which the specified attributes apply.

Discussion

Temporary attributes are used only for onscreen drawing and are not persistent in any way. NSTextView uses them to color misspelled words when continuous spell checking is enabled. Currently the only temporary attributes recognized are those that do not affect layout (colors, underlines, and so on).

See Also

Managing temporary attribute support