View ModifieriOS 16.0+macOS 13.0+tvOS 16.0+watchOS 9.0+
Overloads
5 ways to call compose().lineLimit(). Each is one SwiftUI overload, picked by the arguments you pass.
compose().lineLimit({
from: number,
})nonisolated func lineLimit(_ limit: PartialRangeFrom<Int>) -> some ViewParameters
limit.from*number
Discussion
Use this modifier to specify a partial range of lines that a Text
view or a vertical TextField can occupy. When the text of such
views occupies less space than the provided limit, that view expands to
occupy the minimum number of lines.
Form {
TextField("Title", text: $model.title)
TextField("Notes", text: $model.notes, axis: .vertical)
.lineLimit(3...)
}See also
More in Text and symbols.
- allowsTighteningSets whether text in this view can compress the space between characters when necessary to fit text in a line.
- autocorrectionDisabledSets whether to disable autocorrection for this view.
- baselineOffsetSets the vertical offset for the text relative to its baseline in this view.
- boldApplies a bold font weight to the text in this view.
- findDisabledPrevents find and replace operations in a text editor.
- findNavigatorProgrammatically presents the find and replace interface for text editor views.
- fontSets the default font for text in this view.
- fontDesignSets the font design of the text in this view.
- fontWeightSets the font weight of the text in this view.
- fontWidthSets the font width of the text in this view.
- interactionActivityTrackingTagSets a tag that you use for tracking interactivity.
- italicApplies italics to the text in this view.