21.4 Text Line Limits and Layout Priority
By default, an HStack will attempt to display the text within its Text view children on a single line. Take, for example, the following HStack declaration containing an Image view and two Text views:
HStack {
Image(systemName: "airplane")
Text("Flight times:")
Text("London")
}
.font(.largeTitle)
If the stack has enough room, the above layout will appear as follows:
Figure 21-5
If a stack has insufficient room (for example if it is constrained by a frame or is competing for space with sibling views) the text will automatically wrap onto multiple lines when necessary:
Figure 21-6
While this may work for some situations, it may become an issue if the user interface is required to display this text in a single line. The number of lines over which text can flow can be restricted using the lineCount() modifier...