D. Using 'rows' parameter instead of 'columns' in LazyVGrid
Solution
Step 1: Check parameter name for LazyVGrid
LazyVGrid requires 'columns' parameter, not 'rows'. Using 'rows' causes error.
Step 2: Confirm other parts are valid
Text views can be inside LazyVGrid; ForEach is optional for multiple views.
Final Answer:
Using 'rows' parameter instead of 'columns' in LazyVGrid -> Option D
Quick Check:
LazyVGrid needs 'columns' parameter [OK]
Hint: LazyVGrid uses 'columns', not 'rows' [OK]
Common Mistakes:
Confusing rows and columns parameters
Thinking ForEach is mandatory
Misunderstanding GridItem types
5. You want to create a grid with 3 columns where the first column is fixed width 100, the second is flexible, and the third is adaptive with minimum 80 width. Which code correctly defines the columns array for LazyVGrid?
hard
A. [GridItem(.adaptive(minimum: 80)), GridItem(.fixed(100)), GridItem(.flexible())]
B. [GridItem(.flexible()), GridItem(.fixed(100)), GridItem(.adaptive(minimum: 80))]
C. [GridItem(.fixed(100)), GridItem(.flexible()), GridItem(.adaptive(minimum: 80))]
D. [GridItem(.fixed(100)), GridItem(.adaptive(minimum: 80)), GridItem(.flexible())]
Solution
Step 1: Match column order with requirements
The first column must be fixed width 100, second flexible, third adaptive minimum 80.