I'm using a ForEach loop to display different bars with numbers underneath them to display a graph. However, I can't seem to use a VStack inside of the ForEach loop inside of an HStack to display multiple bars next to each other, all with a number underneath.
HStack{
ForEach(0 ..< 7) {
VStack {
Capsule().frame(width: 30, height: 200)
Text("\($0 + 1)")
}
}
}
I've tried using moving the VStack outside of the ForEach loop but this results in the bars being displayed below each other. How can I display the number underneath the bar whilst arranging the multiple bars next to each other?
