Bird
0
0

Identify the error in this SwiftUI code snippet:

medium📝 Debug Q6 of 15
iOS Swift - Navigation
Identify the error in this SwiftUI code snippet:
NavigationLink(destination: Text("Next View"))
Text("Go")
AText("Go") should be inside destination parameter.
BMissing braces around the label view.
CDestination view must be a NavigationView.
DNavigationLink cannot have Text as label.
Step-by-Step Solution
Solution:
  1. Step 1: Check NavigationLink syntax

    The label view must be inside braces after the destination parameter.
  2. Step 2: Identify missing braces

    Text("Go") is outside NavigationLink, so braces are missing to include it as label.
  3. Final Answer:

    Missing braces around the label view. -> Option B
  4. Quick Check:

    Label must be in braces after destination [OK]
Quick Trick: Label view must be inside braces after destination [OK]
Common Mistakes:
  • Omitting braces for label
  • Putting label outside NavigationLink
  • Confusing destination and label parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes