We are going to use a 2D array to create the grid. Inside a VStack, add a ForEach loop that takes the 2D array. For each array of images inside our 2D array, add a second loop (from 0 to less than 3). Check if the index is not out of range, then add the Image view. When the index is out of range, add an empty Rectangle(). If you don’t want to use a Rectangle(), then you can use leading alignment and re-center the grid.
Report Story
Trending now