Bird
0
0

Which property wrapper is used inside an ObservableObject class to mark properties that trigger view updates?

easy📝 Conceptual Q2 of 15
iOS Swift - State Management in SwiftUI
Which property wrapper is used inside an ObservableObject class to mark properties that trigger view updates?
A@State
B@Binding
C@ObservedObject
D@Published
Step-by-Step Solution
Solution:
  1. Step 1: Identify property wrappers for ObservableObject

    @Published marks properties that send change notifications.
  2. Step 2: Differentiate from other wrappers

    @State is for local view state, @Binding links views, @ObservedObject is for view properties.
  3. Final Answer:

    @Published -> Option D
  4. Quick Check:

    Property wrapper for ObservableObject updates = @Published [OK]
Quick Trick: @Published triggers view updates inside ObservableObject [OK]
Common Mistakes:
  • Using @State inside ObservableObject class
  • Confusing @ObservedObject with @Published
  • Using @Binding incorrectly for data storage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes