Bird
0
0

What is wrong with this TabView code snippet? TabView { Text("Feed").tabItem { Label("Feed", systemImage: "list.bullet") } Text("Messages").tabItem { Label("Messages") } }

medium📝 Debug Q7 of 15
iOS Swift - Navigation
What is wrong with this TabView code snippet? TabView { Text("Feed").tabItem { Label("Feed", systemImage: "list.bullet") } Text("Messages").tabItem { Label("Messages") } }
AThe second tab's Label is missing the systemImage parameter.
BTabView cannot have more than one Text view.
CThe first tab's systemImage name is invalid.
DThe .tabItem modifier must be outside the TabView.
Step-by-Step Solution
Solution:
  1. Step 1: Check .tabItem Label parameters

    The second tab's Label lacks the required systemImage parameter, which is needed for tab icons.
  2. Step 2: Validate other parts

    The first tab's systemImage "list.bullet" is valid. TabView can have multiple Text views. .tabItem must be inside each view.
  3. Final Answer:

    The second tab's Label is missing the systemImage parameter. -> Option A
  4. Quick Check:

    Label in .tabItem needs systemImage [OK]
Quick Trick: Label in .tabItem must include systemImage [OK]
Common Mistakes:
  • Omitting systemImage in Label
  • Thinking TabView limits number of views
  • Placing .tabItem outside TabView

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes