Reputation: 75
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
Upvotes: 5
Views: 2873
Reputation: 257711
Add spacing in grid item
var rows: [GridItem] = [.init(.adaptive(minimum: 60), spacing: 2)]
Upvotes: 7