I have used adaptive
and flexible
with minimum
size with no luck.
struct ContentView: View {
let rows = [
GridItem(.adaptive(minimum: 80)) // lowering this cuases an unwanted shrink of text.
]
var body: some View {
LazyVGrid(columns: rows, spacing: 8) {
ForEach((0...10), id: \.self) { item in
Text("\(Int.random(in: 0...50000))")
.background(Color.yellow)
}
}
}
}
Result:
As you can see, seems like it takes the minimum
size as a fixed
size instead! Also, note that I don't know the minimum size since Text
is self-sizing.
How can we have a self-sizing item for LazyVGrid
or LazyHGrid
?
I wanted it to look like a tag view.