---
title: "CTLineCreateWithAttributedString(_:)"
framework: coretext
role: symbol
role_heading: Function
path: "coretext/ctlinecreatewithattributedstring(_:)"
---

# CTLineCreateWithAttributedString(_:)

Creates a single immutable line object from an attributed string.

## Declaration

```swift
func CTLineCreateWithAttributedString(_ attrString: CFAttributedString) -> CTLine
```

## Parameters

- `attrString`: The string that creates the line.

## Return Value

Return Value A reference to a CTLine object.

## Discussion

Discussion This function allows clients to create a line without creating a CTTypesetter object. The framework provides a typesetter for single-line typesetting under the hood. Simple elements that don’t require line breaks, such as text labels, can use this API.

## See Also

### Related Documentation

- [CTTypesetterCreateWithAttributedString(_:)](coretext/cttypesettercreatewithattributedstring(_:).md)
- [CTTypesetterCreateWithAttributedStringAndOptions(_:_:)](coretext/cttypesettercreatewithattributedstringandoptions(_:_:).md)
- [CTTypesetterCreateLine(_:_:)](coretext/cttypesettercreateline(_:_:).md)

### Creating Lines

- [CTLineCreateTruncatedLine(_:_:_:_:)](coretext/ctlinecreatetruncatedline(_:_:_:_:).md)
- [CTLineCreateJustifiedLine(_:_:_:)](coretext/ctlinecreatejustifiedline(_:_:_:).md)
