Bird
0
0

Which of these is a correct example of chaining modifiers on a SwiftUI Text view?

easy📝 Conceptual Q2 of 15
iOS Swift - SwiftUI Basics
Which of these is a correct example of chaining modifiers on a SwiftUI Text view?
AText("Hi").font(.title).foregroundColor(.red)
BText("Hi") font(.title) foregroundColor(.red)
CText("Hi").font = .title.foregroundColor = .red
DText("Hi").font(.title), foregroundColor(.red)
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct SwiftUI chaining syntax

    Modifiers are chained by calling them one after another with dots, like .font(...).foregroundColor(...).
  2. Step 2: Check each option

    Only Text("Hi").font(.title).foregroundColor(.red) uses correct dot chaining syntax. Others have syntax errors or wrong punctuation.
  3. Final Answer:

    Text("Hi").font(.title).foregroundColor(.red) -> Option A
  4. Quick Check:

    Correct chaining syntax = dot calls [OK]
Quick Trick: Use dots to chain modifiers in SwiftUI [OK]
Common Mistakes:
  • Omitting dots between modifiers
  • Using commas instead of dots
  • Trying to assign modifiers with =

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes