ScrollView is the generic scrollable container — wrap any content that may exceed the available space, on either axis. List is the iOS-native scrollable list with row chrome, separators, and optional selection tracking. ForEach iterates over data to produce one child per item, and is what you typically pair with the lazy stacks inside a ScrollView or with sections inside a List.
ScrollView
A scrollable container for content that may exceed the available space.The scrollable content. Typically a stack or lazy stack containing the scroll content.
List
A scrollable list with optional selection tracking.List provides built-in scrolling — you don’t need to wrap it in a ScrollView. For selection tracking, each row should have a
.tag() modifier so the list can identify which item is selected. Customize with .listStyle(), .listRowBackground(), and .listRowSeparator(). For a non-list scrollable layout, use ScrollView with LazyVStack.ForEach
Iterates over data to produce components, creating one child per item.A function that returns a component for each item. Receives the item and its index.
Each call to the
content function should return exactly one component. Use Group to return multiple components as one. The index parameter is zero-based.See also
- LazyVStack — lazy vertical stack for long scrollable lists
- LazyHStack — lazy horizontal stack for carousels
- Section — grouping with headers and footers in a List
- Group — return multiple components as one
- Axis — scroll direction values