Bird
0
0

Find the issue in this SwiftUI code:

medium📝 Debug Q7 of 15
iOS Swift - SwiftUI Basics
Find the issue in this SwiftUI code:
Text("Welcome")
  .font(.system(size: "large"))
AFont size must be a number, not a string
BMissing .foregroundColor modifier
CText cannot use .font modifier
DThe string "Welcome" is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Check the font size argument type

    The .system(size:) modifier requires a numeric value, but "large" is a string.
  2. Step 2: Verify other parts

    Text can use .font, and the string "Welcome" is valid.
  3. Final Answer:

    Font size must be a number, not a string -> Option A
  4. Quick Check:

    Font size expects numeric value = C [OK]
Quick Trick: Font size must be numeric, not text [OK]
Common Mistakes:
  • Passing string instead of number for font size
  • Thinking .font requires color
  • Assuming Text content is invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes