ScrollView

#scrollview

Overview

Scrollview works Horizontally and Vertically. By default it works as Vertically.

ScrollView(.horizontal) {
HStack{}  // You should use relevant Stack HStack or LazyHStack
}

ScrollView(.vertical) {
VStack{}  // You should use relevant Stack VStack or LazyVStack
}

Sample Codes

To use ScrollView across the screen you should expand it to the whole screen.

.frame(maxWidth: .infinity)

Sources

Videos

Hacking with Swift / 100 Days / Day-39 - How ScrollView lets us work with scrolling data
Hacking with Swift / 100 Days / Day-39 - How to lay out views in a scrolling grid

Articles / Documents

Last updated