5

Could you suggest how to have a dynamic number of rows in a grid. I have 5 words (these could be different width). The idea is to show them next to each other and if there is no enough space -> move to next row

I'm currently using this

var rows: [GridItem] = [.init(.adaptive(minimum: 60))]
LazyHGrid(rows: rows, spacing: 2)

but the space between rows is too big.

Any idea how to make it is smaller?

Thank you

This what I currently have This is what I'm trying to achieve

YuryTom
  • 75
  • 8

1 Answers1

5

Add spacing in grid item

var rows: [GridItem] = [.init(.adaptive(minimum: 60), spacing: 2)]   
Asperi
  • 228,894
  • 20
  • 464
  • 690