I have an @State variable called bpm which sets the beats per minute. When the textfield changes, how can I update the value of bpm?
Pass a binding to the @State variable as the text
argument of the text field. Add a $ character before the @State variable name to make it a binding.
TextField("BPM:", text: $bpm)
Binding to the text field updates the variable when the contents of the text field change.