Bird
0
0

What is the main purpose of using @Binding in SwiftUI child views?

easy📝 Conceptual Q11 of 15
iOS Swift - State Management in SwiftUI
What is the main purpose of using @Binding in SwiftUI child views?
ATo prevent child views from accessing any parent data
BTo allow child views to read and modify a parent's state directly
CTo pass data only from child to parent without updates
DTo create a new independent state inside the child view
Step-by-Step Solution
Solution:
  1. Step 1: Understand @Binding role

    @Binding creates a two-way connection allowing child views to read and write to a parent's state.
  2. Step 2: Compare with other options

    Other options describe independent state or one-way data flow, which @Binding does not do.
  3. Final Answer:

    To allow child views to read and modify a parent's state directly -> Option B
  4. Quick Check:

    @Binding = two-way parent-child state link [OK]
Quick Trick: Remember @Binding syncs child state with parent state [OK]
Common Mistakes:
  • Confusing @Binding with @State creating independent state
  • Thinking @Binding only passes data one-way
  • Assuming @Binding prevents child from modifying data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes