Complete the code to create a vertical grid with three flexible columns.
let columns = [GridItem(.[1]), GridItem(.flexible()), GridItem(.flexible())] LazyVGrid(columns: columns) { Text("Item 1") Text("Item 2") Text("Item 3") }
The flexible size allows the column to expand and fill available space.
Complete the code to create a horizontal grid with two fixed-size rows.
let rows = [GridItem(.[1](50)), GridItem(.fixed(50))] LazyHGrid(rows: rows) { Text("Row 1") Text("Row 2") }
The fixed size sets the row height to a constant 50 points.
Fix the error in the code to create a vertical grid with adaptive columns of minimum 80 points.
let columns = [GridItem(.[1](minimum: 80))] LazyVGrid(columns: columns) { ForEach(0..<10) { index in Text("Item \(index)") } }
The adaptive size creates as many columns as fit with at least 80 points width.
Fill both blanks to create a horizontal grid with two flexible rows and spacing of 10 points.
let rows = [GridItem(.[1](), spacing: [2]), GridItem(.flexible())] LazyHGrid(rows: rows) { Text("A") Text("B") }
The first row is flexible and has spacing of 10 points between items.
Fill all three blanks to create a vertical grid with adaptive columns minimum 100, spacing 15, and padding 20.
let columns = [GridItem(.[1](minimum: 100), spacing: [2])] LazyVGrid(columns: columns, spacing: [3]) { Text("One") Text("Two") } .padding(20)
The columns use adaptive size with minimum 100 points, spacing 15 points between items, and the grid has 15 points spacing vertically. Padding of 20 points is added around the grid.