---
title: "temporaryAttributes(atCharacterIndex:longestEffectiveRange:in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nslayoutmanager/temporaryattributes(atcharacterindex:longesteffectiverange:in:)"
---

# temporaryAttributes(atCharacterIndex:longestEffectiveRange:in:)

Returns the temporary attributes for a character, and the maximum range they apply to.

## Declaration

```swift
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

Return Value The attributes for the character at location.

## Discussion

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:)](appkit/nslayoutmanager/addtemporaryattributes(_:forcharacterrange:).md)
- [addTemporaryAttribute(_:value:forCharacterRange:)](appkit/nslayoutmanager/addtemporaryattribute(_:value:forcharacterrange:).md)
- [setTemporaryAttributes(_:forCharacterRange:)](appkit/nslayoutmanager/settemporaryattributes(_:forcharacterrange:).md)
- [removeTemporaryAttribute(_:forCharacterRange:)](appkit/nslayoutmanager/removetemporaryattribute(_:forcharacterrange:).md)
- [temporaryAttribute(_:atCharacterIndex:effectiveRange:)](appkit/nslayoutmanager/temporaryattribute(_:atcharacterindex:effectiverange:).md)
- [temporaryAttribute(_:atCharacterIndex:longestEffectiveRange:in:)](appkit/nslayoutmanager/temporaryattribute(_:atcharacterindex:longesteffectiverange:in:).md)
- [temporaryAttributes(atCharacterIndex:effectiveRange:)](appkit/nslayoutmanager/temporaryattributes(atcharacterindex:effectiverange:).md)
