Post

Insert Empty View in Grid

SwiftUI Grid

1
2
3
4
5
6
7
8
9
10
11
12
13
Grid {
	GridRow {
		ColorSquare(color: .pink)
		Color.clear
			.gridCellUnsizedAxes([.horizontal, .vertical])
		ColorSquare(color: .pink)
	}
	GridRow {
		ForEach(0..<3) { _ in
			ColorSquare(color: .green)
		}
	}
}

Results:

Pink Pink
GreenGreenGreen

gridCellUnsizedAxes: Asks grid layouts not to offer the view extra size in the specified axes.

This post is licensed under CC BY 4.0 by the author.