Bird
0
0

What is the main purpose of using LazyVStack or LazyHStack in SwiftUI?

easy📝 Conceptual Q11 of 15
iOS Swift - SwiftUI Layout
What is the main purpose of using LazyVStack or LazyHStack in SwiftUI?
ATo add animations to views automatically
BTo create stacks that load all views immediately
CTo create stacks that load views only when they appear on screen
DTo disable scrolling in a list
Step-by-Step Solution
Solution:
  1. Step 1: Understand Lazy Stacks behavior

    LazyVStack and LazyHStack create views only when they are about to appear on screen, saving memory.
  2. Step 2: Compare with normal stacks

    Normal VStack or HStack create all views immediately, which can be slow for large lists.
  3. Final Answer:

    To create stacks that load views only when they appear on screen -> Option C
  4. Quick Check:

    Lazy stacks load views lazily = D [OK]
Quick Trick: Lazy stacks create views only when visible on screen [OK]
Common Mistakes:
  • Thinking lazy stacks load all views at once
  • Confusing lazy stacks with animation features
  • Assuming lazy stacks disable scrolling

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes