Function

CTLineCreateWithAttributedString(_:)

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

Declaration

func CTLineCreateWithAttributedString(_ attrString: CFAttributedString) -> CTLine

Parameters

string

The string from which the line is created.

Return Value

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

Discussion

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