---
title: "temporaryAttribute(_:atCharacterIndex:effectiveRange:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nslayoutmanager/temporaryattribute(_:atcharacterindex:effectiverange:)"
---

# temporaryAttribute(_:atCharacterIndex:effectiveRange:)

Returns the value for the temporary attribute of a character, and the range it applies to.

## Declaration

```swift
func temporaryAttribute(_ attrName: NSAttributedString.Key, atCharacterIndex location: Int, effectiveRange range: NSRangePointer?) -> Any?
```

## Parameters

- `attrName`: The name of a temporary attribute.
- `location`: The index for which to return attributes. This value must not exceed the bounds of the receiver.
- `range`: If non-NULL: If the named attribute exists at location, on output, contains the range over which the named attribute’s value applies. If the named attribute does not exist at location, on output, contains the range over which the attribute does not exist. The range isn’t necessarily the maximum range covered by attrName, and its extent is implementation-dependent. If you need the maximum range, use doc://com.apple.appkit/documentation/AppKit/NSLayoutManager/temporaryAttribute(_:atCharacterIndex:longestEffectiveRange:in:). If you don’t need this value, pass NULL.

## Return Value

Return Value The value for the temporary attribute named attrName of the character at index location, or nil if there is no such attribute.

## 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:longestEffectiveRange:in:)](appkit/nslayoutmanager/temporaryattribute(_:atcharacterindex:longesteffectiverange:in:).md)
- [temporaryAttributes(atCharacterIndex:effectiveRange:)](appkit/nslayoutmanager/temporaryattributes(atcharacterindex:effectiverange:).md)
- [temporaryAttributes(atCharacterIndex:longestEffectiveRange:in:)](appkit/nslayoutmanager/temporaryattributes(atcharacterindex:longesteffectiverange:in:).md)
