3
Exploring Advanced Components
In the previous chapters, we learned about the essential components of SwiftUI and how they can be put together to design great-looking apps. In this chapter, we’ll discuss how to display large datasets efficiently by making use of SwiftUI’s lazy stacks and lazy grids.
Lazy stacks and lazy grids are named lazy because they do not load in memory all the data when they are created. Instead, they load only the data that they need to display on the screen at a given moment. For example, with a list of 100 items, where only a subset of 10 items is displayed on the screen, the lazy container view will load in memory the subset of 10 items plus the item before and the item after the subset. This behavior optimizes memory ...
Get SwiftUI Cookbook - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.