I'm showing 500 items with different height:
let columns = [
GridItem(.flexible()),
GridItem(.flexible())
]
let randHeight: [CGFloat] = [30, 60, 90]
LazyVGrid(columns: columns, spacing: 20) {
ForEach(memes, id: \.memeid){
meme in
ZStack{
}
.frame(width: memeWidth, height: randHeight[Int.random(in: 0...2)])
.background(Color.white)
}
}
This is the result:
As you can see, the spacing between the items is always different.
How to fix this?