I'm putting a ForEach inside an HStack. I hope each element in ForEach will keep its original width and the parent HStack should overflow the screen as needed. However, this results in that the parent HStack fits the width of the screen and each element inside ForEach get narrowed down into 1/n * screenWidth.
Sample Code:
HStack(alignment: .bottom) {
ForEach(data, id: \.id) { element in
SomeView(data: element)
}
}
I could achieve a similar effect by putting the parent HStack in a ScrollView. But what if I don't want the scroll behavior? I wonder how ScrollView achieve this infinity width?