Both @State
and @Binding
are property wrappers.
@State
- It is used to update the value of a variable every time.
- We can also say it’s a two way binding.
- If we change the property state then SwiftUI will automatically reload the body of the view.
- It is used for simple properties like strings, integers and booleans.
@Binding
- Using this, you can access the state property of another view.
- It will give you the read and write access for the variable.