Bird
0
0

Which SwiftUI component is best suited for creating a horizontally scrolling grid?

easy📝 Conceptual Q2 of 15
iOS Swift - SwiftUI Layout
Which SwiftUI component is best suited for creating a horizontally scrolling grid?
ALazyHGrid
BLazyVGrid
CList
DScrollView
Step-by-Step Solution
Solution:
  1. Step 1: Identify horizontal grid component

    LazyHGrid is designed for horizontal grids that scroll horizontally.
  2. Step 2: Eliminate other options

    LazyVGrid scrolls vertically, List is a vertical list, and ScrollView is a container but not a grid.
  3. Final Answer:

    LazyHGrid -> Option A
  4. Quick Check:

    Horizontal grid = LazyHGrid [OK]
Quick Trick: Use LazyHGrid for horizontal grids, LazyVGrid for vertical [OK]
Common Mistakes:
  • Mixing LazyVGrid and LazyHGrid
  • Using List for grid layouts
  • Assuming ScrollView creates grids automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes