addTemporaryAttribute(_:value:forCharacterRange:)
Adds a temporary attribute to the characters in the specified range.
Declaration
func addTemporaryAttribute(_ attrName: NSAttributedString.Key, value: Any, forCharacterRange charRange: NSRange)Parameters
- attrName:
The name of a temporary attribute.
- value:
The temporary attribute value associated with
attrName. - charRange:
The range of characters to which the specified attribute-value pair applies.
Discussion
Raises an invalidArgumentException if attrName or value is nil.
See Also
Managing temporary attribute support
addTemporaryAttributes(_:forCharacterRange:)setTemporaryAttributes(_:forCharacterRange:)removeTemporaryAttribute(_:forCharacterRange:)temporaryAttribute(_:atCharacterIndex:effectiveRange:)temporaryAttribute(_:atCharacterIndex:longestEffectiveRange:in:)temporaryAttributes(atCharacterIndex:effectiveRange:)temporaryAttributes(atCharacterIndex:longestEffectiveRange:in:)