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

# temporaryAttributes(atCharacterIndex:longestEffectiveRange:in:)

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

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

The attributes for the character at `location`.

## Discussion

If you don’t need the longest effective range, it’s far more efficient to use the [`temporaryAttributes(atCharacterIndex:effectiveRange:)`](/documentation/AppKit/NSLayoutManager/temporaryAttributes(atCharacterIndex:effectiveRange:)) method to retrieve the attribute value.

---

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)