From the course: iOS 14 Development Essential Training

Unlock the full course today

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

Getting text input with SwiftUI

Getting text input with SwiftUI

From the course: iOS 14 Development Essential Training

Start my 1-month free trial

Getting text input with SwiftUI

- [Instructor] Another important concept in SwiftUI is binding. Binding is where you connect some code value to a user interface value so that when one changes, the other is automatically updated. Binding is required for some user interface elements like text fields that accept user input. Let's take a look at how binding works. So let's say, I have a variable in my code. So above body, I'm going to create a line that says, var and then space. We'll call this name and I'm going to set it equal to an empty string. Remember, in a previous movie, we looked at making a very simple app with a storyboard that says, "Hello" and then a name that the user enters into a text field after pressing a button. We're going to look at making that using SwiftUI and binding and I hope it drives home the point that sometimes using SwiftUI can be less complicated than working with a storyboard. So what we want to do is say, "Hello" to…

Contents