iOS 16: Grids

Thimo Bess
arconsis
Published in
2 min readMar 1, 2023

With the help of grids, you can easily lay out static data.
It is important to note that you should only use them for static data because grids are not lazy, i.e. all elements are instantiated directly and are in memory. With large amounts of data, this can be a problem.

Grids are divided into individual rows. You can think of a grid simply as a table. If you have multiple rows, the first element from row 1 is displayed in the same column as the first element from row 2, and so on. That’s the difference from an HStack with which you can achieve almost the same layout. But you have to align the different rows by yourself.

It is also possible to configure the horizontal spacing with just one parameter (see the example below).

If the numbers of columns are different in the rows, the grid will automatically add empty “cells” to it.

With the help of the grids, you can also generate more complex arrangements very quickly.
So you can change the number of columns even in individual rows.

A complex example of a grid layout with multiple columns and rows
Complex Grid Layout

There are a lot more options to configure a grid. If you are interested in how to use them check out the video above!

If you are interested in more iOS 16 feature videos, check out the following playlist.

--

--