I'm working with a LazyVGrid
with SwiftUI
to display 8 images.
As you can see from the photo, the dimensions of the images are not uniform, some are exact, others have a lower height than the next photo ..
I don't understand why this happens .. Do you have any ideas to solve the problem?
This is how I created the LazyVGrid
LazyVGrid(columns: [GridItem(.adaptive(minimum: 160), spacing: 10)], spacing: 20) {
ForEach(productsItems) { product in
VStack {
Image(product.image)
.resizable()
.scaledToFill()
.cornerRadius(5)
.padding(5)
.background(
RoundedRectangle(cornerRadius: 5)
.stroke(.gray, lineWidth: 0.5)
)
}
}
}