So I am trying to get a custom grid with cells of different size. I have kinda gotten stuck here. So I have one particular cell with the height and size double that of all the others. But the left side of the cell requires two rows instead of one. How can I force to add two more boxes below H3 or to left of H4 box in the picture below.
Here is my code:
struct CustomGridView: View {
var body: some View {
let gridItems = [GridItem(.fixed(150), spacing: 10, alignment: .leading),
GridItem(.fixed(150), spacing: 10, alignment: .leading),
GridItem(.fixed(150), spacing: 10, alignment: .leading)]
LazyVGrid(columns: gridItems, spacing: 10) {
ForEach(0..<9) { g in
Text("H:\(g)")
.frame(width: g == 4 ? 310 : 150, height: g == 4 ? 310 : 150)
.background(Color.red)
if g == 4 { Color.clear }
}
}
.frame(width: 470)
}
}
Here is the screen shot of the grid situation so far:
Any help with this will be appreciated.