Here's a simple example:
struct Example: View {
var body: some View {
ScrollView([.horizontal, .vertical], showsIndicators: false, content: {
LazyVStack(content: {
ForEach(1...10, id: \.self) { count in
Text("Item \(count)")
}
})
})
}
}
The problem is that when both axes are used ([.horizontal, .vertical]
), ScrollView
automatically centers any content inside vertically and horizontally. I have a big data table in the ScrollView
, and I need it to be aligned to top instead but I couldn't figure out how to do this. Usual stuff with Vstack
s and Spacer
s doesn't work here at all.