Instance Method

lineLimit(_:)

Sets the maximum number of lines that text can occupy in this view.

Declaration

func lineLimit(_ number: Int?) -> some View

Parameters

number

The line limit. If nil, no line limit applies.

Return Value

A view that limits the number of lines that Text instances display.

Discussion

The line limit applies to all Text instances within this view. For example, an HStack with multiple pieces of text longer than three lines caps each piece of text to three lines rather than capping the total number of lines across the HStack.

See Also

Adjusting Text in a View

func font(Font?) -> View

Sets the default font for text in this view.

Beta
func lineSpacing(CGFloat) -> View

Sets the amount of space between lines of text in this view.

Beta
func minimumScaleFactor(CGFloat) -> View

Sets the minimum amount that text in this view scales down to fit in the available space.

Beta
func truncationMode(Text.TruncationMode) -> View

Sets the truncation mode for lines of text that are too long to fit in the available space.

Beta
func allowsTightening(Bool) -> View

Sets whether text in this view can compress the space between characters when necessary to fit text in a line.

Beta
func flipsForRightToLeftLayoutDirection(Bool) -> View

Sets whether this view flips its contents horizontally when the layout direction is right-to-left.

Beta

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