<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextLineFragment/init(attributedString:range:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextLineFragment(im)initWithAttributedString:range:"
  },
  "title" : "init(attributedString:range:)"
}
-->

# init(attributedString:range:)

Creates a new line fragment from the attributed string for the range of characters you specify.

```
init(attributedString: NSAttributedString, range: NSRange)
```

## Parameters

`attributedString`

The attributed string.

`range`

An <doc://com.apple.documentation/documentation/Foundation/NSRange-c.struct> that specifies which characters to include.

---

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)