Bird
0
0

What will happen if you omit the .tabItem modifier on one of the views inside a TabView?

medium📝 ui behavior Q5 of 15
iOS Swift - Navigation
What will happen if you omit the .tabItem modifier on one of the views inside a TabView?
AThe view will automatically get a default tab with no label or icon.
BThat view will not have a tab and will not be accessible via the tab bar.
CThe app will crash at runtime.
DThe tab bar will show an empty tab for that view.
Step-by-Step Solution
Solution:
  1. Step 1: Understand .tabItem role

    The .tabItem modifier defines the tab label and icon for a view inside TabView.
  2. Step 2: Effect of omitting .tabItem

    If a view lacks .tabItem, it won't appear as a tab and thus won't be accessible via the tab bar, but the app won't crash.
  3. Final Answer:

    That view will not have a tab and will not be accessible via the tab bar. -> Option B
  4. Quick Check:

    Missing .tabItem means no tab shown [OK]
Quick Trick: Every tab needs .tabItem or it won't appear [OK]
Common Mistakes:
  • Assuming app crashes without .tabItem
  • Expecting default tabs without .tabItem
  • Thinking empty tabs appear automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes