Bird
0
0

Identify the error in this SwiftUI code:

medium📝 Debug Q6 of 15
iOS Swift - SwiftUI Basics
Identify the error in this SwiftUI code:
VStack(
  Text("Hello"),
  Text("World")
)
AVStack requires braces {}, not parentheses ()
BText views must be inside an array []
CText views cannot be used inside VStack
DVStack must have only one child view
Step-by-Step Solution
Solution:
  1. Step 1: Check VStack syntax

    VStack uses braces {} to group child views, not parentheses.
  2. Step 2: Analyze given code

    Code uses parentheses which causes syntax error.
  3. Final Answer:

    VStack requires braces {}, not parentheses () -> Option A
  4. Quick Check:

    VStack uses {} for children [OK]
Quick Trick: Use {} not () to group views in VStack [OK]
Common Mistakes:
  • Using parentheses instead of braces
  • Trying to pass views as function arguments
  • Misunderstanding VStack child view rules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes