Contents

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 at location, clipped to rangeLimit.

  • 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