The problem is that Swift differentiates between “show the value of this property here” and “show the value of this property here, but write any changes back to the property.”
In the case of our text field, Swift needs to make sure whatever is in the text is also in the name property, so that it can fulfill its promise that our views are a function of their state – that everything the user can see is just the visible representation of the structs and properties in our code.
This is what’s called a two-way binding: we bind the text field so that it shows the value of our property, but we also bind it so that any changes to the text field also update the property.
struct ContentView: View {
@State private var name = ""
var body: some View {
Form {
TextField("Enter your name", text: $name)
Text("Hello World")
}
}
}
I dont understand this differentiates.
In this sentences “show the value of this property here” does that mean only assign the value once?
ın second sentences “show the value of this property here, but write any changes back to the property.” does that mean assign the value to property but if there is a change so change the value and assign the property?
ı stuck in this section. I dont understand totally