Contents

attributes(at:effectiveRange:)

Returns the attributes for the character at the specified index.

Declaration

func attributes(at location: Int, effectiveRange range: NSRangePointer?) -> [NSAttributedString.Key : Any]

Parameters

  • location:

    The index for which to return attributes. This value must lie within the bounds of the receiver.

  • range:

    Upon return, the range over which the attributes and values are the same as those at index. This range isn’t necessarily the maximum range covered, and its extent is implementation-dependent. If you need the maximum range, use Attributes(at:longesteffectiverange:in:). If you don’t need this value, pass NULL.

Return Value

The attributes for the character at index.

Discussion

Raises an rangeException if index lies beyond the end of the receiver’s characters.

For a list of possible attributes, see NSAttributedString.Key.

See Also

Getting attributes for a range of text