Pick the fix
A SwiftUI screen shows 10,000 rows and takes seconds to appear. Fix?
Hint 1 of 1
Which containers build rows on demand?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Use List, or a LazyVStack inside a ScrollView, so rows are created as they appear
Correct. Only visible rows are built.
Why not the others?
- B Wrap the VStack in a ScrollView. A plain VStack still builds every row up front.
- C Use an HStack instead. It's just as eager, in the other direction.
- D Add .id(UUID()) to each row. New ids every render make it slower.