From the course: Introducing App Development for iOS 14

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Understanding binding properties

Understanding binding properties

From the course: Introducing App Development for iOS 14

Start my 1-month free trial

Understanding binding properties

- [Instructor] One of the great reasons to use Swift UI is something called binding. Binding enables you to connect some sort of value to your user interface. And you can use that throughout your code. So in our view right here, we have our text field in our slider that we haven't really created yet we just have placeholders for them. But we need data from the text field to figure out the amount of money to calculate the total tip. We need a value from the slider did calculate that as well. Traditionally, you'd have to create some variable object in your code, and then whenever the text field is updated, you update that variable, and when the sliders updated, you use that variable in the total. With Swift UI, the process is simplified. You have to use something called binding. So to create a binding variable, go to this line, line 10, that creates the view, so after we have Coleman view, and then right above our body,…

Contents