<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAttributedString/rulerAttributes(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSAttributedString(im)rulerAttributesInRange:"
  },
  "title" : "rulerAttributes(in:)"
}
-->

# rulerAttributes(in:)

Returns the ruler (paragraph) attributes in effect for the characters within the specified range.

```
func rulerAttributes(in range: NSRange) -> [NSAttributedString.Key : Any]
```

## Parameters

`range`

The range.

## Return Value

A dictionary containing the ruler attributes in the range.

## Discussion

The only ruler attribute currently defined is that named by [`paragraphStyle`](/documentation/Foundation/NSAttributedString/Key/paragraphStyle). Use this method to obtain attributes that are to be copied or pasted with “copy ruler” operations.

Raises an [`rangeException`](/documentation/Foundation/NSExceptionName/rangeException) if any part of `aRange` lies beyond the end of the receiver’s characters.

---

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)