Bird
0
0

How do you correctly create a SwiftUI Text view that displays the string "Welcome"?

easy📝 Syntax Q3 of 15
iOS Swift - SwiftUI Basics
How do you correctly create a SwiftUI Text view that displays the string "Welcome"?
AText = "Welcome"
BText("Welcome")
CTextView("Welcome")
DUILabel(text: "Welcome")
Step-by-Step Solution
Solution:
  1. Step 1: Recall SwiftUI Text syntax

    SwiftUI's Text view is initialized with a string using Text("string").
  2. Step 2: Evaluate options

    Text("Welcome") matches the correct syntax; others are either UIKit or invalid.
  3. Final Answer:

    Text("Welcome") -> Option B
  4. Quick Check:

    Text view uses initializer with string [OK]
Quick Trick: Use Text("string") to create text views [OK]
Common Mistakes:
  • Confusing UIKit UILabel with SwiftUI Text
  • Using assignment instead of initializer
  • Using incorrect view names like TextView

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes