scrollview | SwiftUI

I put this code but the horizontal scrolling doesn't working.



struct HStackScrollView: View {

var body: some View {

ScrollView {

HStack(alignment: .top){

ForEach(0..<100) { number in

Text("Print value Row\(number)")

.frame(width: 200, height: 100)

.background(Color.blue)

}

}

}

}

}


Can help me?

Replies

Can you better describe "doesn't working" - does that mean the text is on one line in the frame and the frame won't shift l/r to show them all, or the items wrap and the frame doesn't force scrolling/go wider? Is the horiz. scrollbar displayed?

I got mine working by adding: ScrollView(.horizontal) {