1

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:

enter image description here

As you can see, the spacing between the items is always different.

How to fix this?

user19559647
  • 191
  • 1
  • 1
  • 7

0 Answers0