temporaryAttributes(atCharacterIndex:longestEffectiveRange:in:)
Returns the temporary attributes for a character, and the maximum range they apply to.
Declaration
func temporaryAttributes(atCharacterIndex location: Int, longestEffectiveRange range: NSRangePointer?, in rangeLimit: NSRange) -> [NSAttributedString.Key : Any]Parameters
- location:
The index for which to return attributes. This value must not exceed the bounds of the receiver.
- range:
If not
NULL, on output, contains the maximum range over which the attributes and values are the same as those atlocation, clipped torangeLimit. - rangeLimit:
The range over which to search for continuous presence of the attributes at
location. This value must not exceed the bounds of the receiver.
Return Value
The attributes for the character at location.
Discussion
If you don’t need the longest effective range, it’s far more efficient to use the temporaryAttributes(atCharacterIndex:effectiveRange:) method to retrieve the attribute value.
See Also
Managing temporary attribute support
addTemporaryAttributes(_:forCharacterRange:)addTemporaryAttribute(_:value:forCharacterRange:)setTemporaryAttributes(_:forCharacterRange:)removeTemporaryAttribute(_:forCharacterRange:)temporaryAttribute(_:atCharacterIndex:effectiveRange:)temporaryAttribute(_:atCharacterIndex:longestEffectiveRange:in:)temporaryAttributes(atCharacterIndex:effectiveRange:)