<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextContentStorageDelegate/textContentStorage(_:textParagraphWith:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextContentStorageDelegate(im)textContentStorage:textParagraphWithRange:"
  },
  "title" : "textContentStorage(_:textParagraphWith:)"
}
-->

# textContentStorage(_:textParagraphWith:)

Returns a custom `NSTextParagraph` for the specified range in the content storage’s attributed string.

```
optional func textContentStorage(_ textContentStorage: NSTextContentStorage, textParagraphWith range: NSRange) -> NSTextParagraph?
```

## Parameters

`textContentStorage`

The object’s content manager.

`range`

The <doc://com.apple.documentation/documentation/Foundation/NSRange-c.struct> that describes the extent of the string.

## Return Value

A new [`NSTextParagraph`](/documentation/AppKit/NSTextParagraph), or `nil`.

## Discussion

When non-nil, `textContentStorage` uses the text paragraph instead of
creating the standard [`NSTextParagraph`](/documentation/AppKit/NSTextParagraph) with the attributed substring in
range. The attributed string for a custom text paragraph must have
`range.length`.

Returns a custom paragraph for a range that you provide from the object’s attributed string.

## Discussion

When non-`nil`, `textContentStorage` uses the text paragraph instead of creating the standard [`NSTextParagraph`](/documentation/AppKit/NSTextParagraph) with the attributed substring in range. The attributed string for a custom text paragraph must have a length of `range.length`.

---

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)