<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSLayoutManager/temporaryAttribute(_:atCharacterIndex:effectiveRange:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLayoutManager(im)temporaryAttribute:atCharacterIndex:effectiveRange:"
  },
  "title" : "temporaryAttribute(_:atCharacterIndex:effectiveRange:)"
}
-->

# temporaryAttribute(_:atCharacterIndex:effectiveRange:)

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

```
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 [`temporaryAttribute(_:atCharacterIndex:longestEffectiveRange:in:)`](/documentation/AppKit/NSLayoutManager/temporaryAttribute(_:atCharacterIndex:longestEffectiveRange:in:))    . If you don’t need this value, pass     `NULL`    .

## Return Value

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

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)