Bird
0
0

Which of the following is the correct syntax to create a List with static text items in SwiftUI?

easy📝 Syntax Q3 of 15
iOS Swift - SwiftUI Layout
Which of the following is the correct syntax to create a List with static text items in SwiftUI?
AList(["Apple", "Banana", "Cherry"])
BList { Text("Apple") Text("Banana") Text("Cherry") }
CList { "Apple", "Banana", "Cherry" }
DList(Text("Apple"), Text("Banana"), Text("Cherry"))
Step-by-Step Solution
Solution:
  1. Step 1: Understand static List syntax

    Static lists use a closure with multiple views inside curly braces.
  2. Step 2: Check options

    List { Text("Apple") Text("Banana") Text("Cherry") } correctly places multiple Text views inside List's closure. Others misuse array or parameters.
  3. Final Answer:

    List { Text("Apple") Text("Banana") Text("Cherry") } -> Option B
  4. Quick Check:

    Static List uses closure with views inside braces [OK]
Quick Trick: Static List uses closure with multiple Text views [OK]
Common Mistakes:
  • Passing array without closure for static items
  • Using commas inside List closure
  • Trying to pass multiple views as parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes