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

# init(string:attributes:range:)

Creates a new line fragment using the string, attributes, and range you provide.

```
convenience init(string: String, attributes: [NSAttributedString.Key : Any] = [:], range: NSRange)
```

## Parameters

`string`

An attributed string.

`attributes`

A dictionary of attributes.

`range`

The range to use from `string`.

---

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)