The Art of Displaying Grids
This chapter will discuss how you can create grid structures in your SwiftUI applications.
We won’t cover supporting iOS 13; that would require the old approach with nested stacks. The old approach would have created a grid by using horizontal stacks, each representing a row inside a vertical stack. You could also do the opposite, but this would be less common. As SwiftUI evolved, we can now represent orthogonal grids directly, instead of having to compose them. Grids are among the most important ways to structure content in iOS and are essential in other Apple platforms as well.
In this chapter, we are going to show you how by covering these main topics:
- Displaying grids in iOS
- The grid view
- Lazy grids
- Using GridItem to control the lazy grid layout
- Conditional formatting of a view
- Reacting to device rotation
At the end of this chapter, you will be able to decide whether to use eager or lazy grids, knowing...