[ad_1]
I’ve a easy code which shows the Array in Grid. Is it doable to point out objects as an ark formed array primarily based Upon accessible width and Merchandise numbers.
import SwiftUI
struct ContentView: View {
let columns = [
GridItem(.flexible()),
GridItem(.flexible()),
GridItem(.flexible()),
GridItem(.flexible()),
GridItem(.flexible())
]
var physique: some View {
ScrollView {
LazyVGrid(columns: columns, spacing: 15) {
ForEach(0..<20) { quantity in
Rectangle()
.foregroundColor(Colour.pink)
.body(width: 50, peak: 80)
.cornerRadius(10)
.shadow(colour: .black, radius: 5, x: 2, y: 2)
.overlay(
Textual content("(quantity)").foregroundColor(.white)
)
}
}.padding(.all, 10)
}
}
}
Result’s like this
Outcomes
I would really like one thing like following picture.
Desired
Thanks.
[ad_2]
