<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/NSTextLayoutManager/addRenderingAttribute(_:value:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextLayoutManager(im)addRenderingAttribute:value:forTextRange:"
  },
  "title" : "addRenderingAttribute(_:value:for:)"
}
-->

# addRenderingAttribute(_:value:for:)

Sets the rendering attribute for the value and range you specify.

```
func addRenderingAttribute(_ renderingAttribute: NSAttributedString.Key, value: Any?, for textRange: NSTextRange)
```

## Parameters

`renderingAttribute`

The <doc://com.apple.documentation/documentation/Foundation/NSAttributedString/Key> that represents the attribute.

`value`

The value for the attribute.

`textRange`

The range over which to apply the attribute.

## Discussion

Passing `nil` overrides the specified attribute by removing it from the final attributes the framework passes to the layout and rendering engine. This is a convenience method for [`setRenderingAttributes(_:for:)`](/documentation/UIKit/NSTextLayoutManager/setRenderingAttributes(_:for:)).

---

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)