Instance Method

truncationMode(_:)

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

Declaration

func truncationMode(_ mode: Text.TruncationMode) -> some View

Parameters

mode

The truncation mode.

Return Value

A view that truncates text at different points in a line depending on the mode you select.

Discussion

Use the truncationMode(_:) modifier to determine whether text in a long line is truncated at the beginning, middle, or end. Truncation adds an ellipsis (…) to the line when removing text to indicate to readers that text is missing.

See Also

Adjusting Text in a View

func keyboardType(UIKeyboardType) -> View

Sets the keyboard type for this view.

func font(Font?) -> View

Sets the default font for text in the view.

func lineLimit(Int?) -> View

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

func lineSpacing(CGFloat) -> View

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

func minimumScaleFactor(CGFloat) -> View

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

func allowsTightening(Bool) -> View

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

func textContentType(UITextContentType?) -> View

Sets the text content type for this view, which the system uses to offer suggestions while the user enters text on an iOS or tvOS device.

func flipsForRightToLeftLayoutDirection(Bool) -> View

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

func autocapitalization(UITextAutocapitalizationType) -> View

Sets whether to apply auto-capitalization to this view.

func disableAutocorrection(Bool?) -> View

Sets whether to disable autocorrection for this view.