Bird
0
0

What will be the vertical spacing between Text views in this SwiftUI VStack?

medium📝 ui behavior Q5 of 15
iOS Swift - SwiftUI Layout
What will be the vertical spacing between Text views in this SwiftUI VStack?
VStack(spacing: 20) {
  Text("Hello")
  Text("World")
}
A40 points of vertical space between the texts
BNo space between the texts
C20 points of vertical space between the texts
DDefault system spacing between the texts
Step-by-Step Solution
Solution:
  1. Step 1: Understand VStack spacing parameter

    The spacing parameter sets the vertical gap between views inside VStack.
  2. Step 2: Check the given spacing value

    Here spacing is set to 20 points explicitly.
  3. Final Answer:

    20 points of vertical space between the texts -> Option C
  4. Quick Check:

    VStack spacing = specified value [OK]
Quick Trick: VStack spacing sets vertical gap in points [OK]
Common Mistakes:
  • Assuming default spacing when specified
  • Doubling spacing by mistake

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes