Bird
0
0

What role does the @State property wrapper play in SwiftUI's view lifecycle?

easy📝 Conceptual Q1 of 15
iOS Swift - State Management in SwiftUI
What role does the @State property wrapper play in SwiftUI's view lifecycle?
AIt manages network requests automatically
BIt defines a constant value that never changes
CIt stores mutable data that triggers UI refresh when changed
DIt handles user input events directly
Step-by-Step Solution
Solution:
  1. Step 1: Understand @State

    @State marks a variable as mutable state owned by the view.
  2. Step 2: Reactive UI updates

    When the @State variable changes, SwiftUI re-renders the view to reflect the new state.
  3. Final Answer:

    It stores mutable data that triggers UI refresh when changed -> Option C
  4. Quick Check:

    State drives UI updates by storing mutable data [OK]
Quick Trick: State holds mutable data causing UI refresh [OK]
Common Mistakes:
  • Confusing @State with constants
  • Assuming @State manages network or events
  • Thinking @State variables don't trigger UI updates

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes