Modifiers
lineLimit
Sets the line limit for text in the view.
lineLimit()
Overload #1
Sets the line limit for text in the view.
Four variants matching SwiftUI:
lineLimit()— no line limit (unlimited lines)lineLimit(5)— max 5 lineslineLimit(5, { reservesSpace: true })— max 5 lines, reserves height even when empty (iOS 16+, tvOS 16+)lineLimit({ min: 3, max: 8 })— range of 3 to 8 lines (iOS 16+, tvOS 16+)
Returns: ModifierConfig
See: Official SwiftUI documentation.
lineLimit(limit, options)
Overload #2
| Parameter | Type |
|---|---|
limit | number |
options(optional) | { reservesSpace: boolean } |
Sets the line limit for text in the view.
Four variants matching SwiftUI:
lineLimit()— no line limit (unlimited lines)lineLimit(5)— max 5 lineslineLimit(5, { reservesSpace: true })— max 5 lines, reserves height even when empty (iOS 16+, tvOS 16+)lineLimit({ min: 3, max: 8 })— range of 3 to 8 lines (iOS 16+, tvOS 16+)
Returns: ModifierConfig
See: Official SwiftUI documentation.
lineLimit(range)
Overload #3
| Parameter | Type |
|---|---|
range | { max: number, min: number } |
Sets the line limit for text in the view.
Four variants matching SwiftUI:
lineLimit()— no line limit (unlimited lines)lineLimit(5)— max 5 lineslineLimit(5, { reservesSpace: true })— max 5 lines, reserves height even when empty (iOS 16+, tvOS 16+)lineLimit({ min: 3, max: 8 })— range of 3 to 8 lines (iOS 16+, tvOS 16+)
Returns: ModifierConfig
See: Official SwiftUI documentation.
Works with
This modifier works with any view. These components accept it:
- VStack
- HStack
- ZStack
- LazyVStack
- LazyHStack
- Group
- Spacer
- Divider
- Overlay
- ScrollView
- Button
- Toggle
- Checkbox
- Slider
- Picker
- DatePicker
- ColorPicker
- Link
- ControlGroup
- Menu
- ContextMenu
- TextField
- SecureField
- Text
- Label
- Image
- List
- Form
- Section
- DisclosureGroup
- SwipeActions
- BottomSheet
- Alert
- ConfirmationDialog
- Popover
- ProgressView
- Gauge
- TabView
- AccessoryWidgetBackground
Sources
The original Expo docs for this page:
- lineLimit (Modifiers) (
source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/modifiers.md)