Creates a single immutable line object directly from an attributed string.


func CTLineCreateWithAttributedString(_ attrString: CFAttributedString) -> CTLine



The string from which the line is created.

Return Value

A reference to a CTLine object if the call was successful; otherwise, NULL.


This function allows clients who need very simple line generation to create a line without creating a typesetter object. The typesetting is done under the hood. Without a typesetter object, the line cannot be properly broken. However, for simple things like text labels, line breaking is not an issue.

See Also

Creating Lines

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software