Instance Method

attributes(at:effectiveRange:)

Returns the attributes for the character at a given index.

Declaration

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

Parameters

index

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

aRange

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 Character Attributes.

See Also

Retrieving Attribute Information

func attributes(at: Int, longestEffectiveRange: NSRangePointer?, in: NSRange)

Returns the attributes for the character at a given index, and by reference the range over which the attributes apply.

func attribute(NSAttributedStringKey, at: Int, effectiveRange: NSRangePointer?)

Returns the value for an attribute with a given name of the character at a given index, and by reference the range over which the attribute applies.

func attribute(NSAttributedStringKey, at: Int, longestEffectiveRange: NSRangePointer?, in: NSRange)

Returns the value for the attribute with a given name of the character at a given index, and by reference the range over which the attribute applies.