Contents

setTemporaryAttributes(_:forCharacterRange:)

Sets one or more temporary attributes for the specified character range.

Declaration

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

Parameters

  • attrs:

    Attributes dictionary containing the temporary attributes to set.

  • 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