32.5 Adding Scrolling Support to a Grid
The above example grids contained a small number of items which were able to fit entirely within the viewing area of the device. A greater number of items will invariably cause the grid to extend beyond the available screen area. Try, for example, increasing the number of items in the ForEach loop of the body view declaration from 8 to 99 as follows:
var body: some View {
LazyVGrid(columns: gridItems, spacing: 5) {
ForEach((0...99), id: \.self) { index in
CellContent(index: index,
color: colors[index % colors.count])
}
...