Enumeration

Text.TruncationMode

The type of truncation to apply to a line of text when it’s too long to fit in the available space.

Declaration

enum TruncationMode

Overview

When a text view contains more text than it's able to display, the view might truncate the text and place an ellipsis (...) at the truncation point. Use the truncationMode(_:) modifier with one of the Text.TruncationMode values to indicate which part of the text to truncate, either at the beginning, in the middle, or at the end.

Topics

Specifying the Truncation Mode

case head

Truncate at the beginning of the line.

case middle

Truncate in the middle of the line.

case tail

Truncate at the end of the line.

Comparing Truncation Modes

static func == (Text.TruncationMode, Text.TruncationMode) -> Bool

Indicates whether two truncation modes are equal.

static func != (Text.TruncationMode, Text.TruncationMode) -> Bool

Indicates whether two truncation modes are not equal.

func hash(into: inout Hasher)

Hashes the essential components of the truncation mode by feeding them into the given hash function.

var hashValue: Int

The hashed value of the truncation mode.

See Also

Fitting Text into Available Space

func allowsTightening(Bool) -> View

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

func minimumScaleFactor(CGFloat) -> View

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

func truncationMode(TruncationMode) -> View

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