From the course: Building Your First iOS 17 App

Unlock this course with a free trial

Join today to access over 23,400 courses taught by industry experts.

Creating a TextField in SwiftUI

Creating a TextField in SwiftUI

- [Instructor] With our variable in place, we're ready to create an editable text field. I'm actually going to create that above the total value here. So between lines 24 and 25, I'm making a new line and I'm going to type out text and then field with a capital F. And when that gets highlighted in the coding thing, choose the one that says titleKey text. Just press Return on your keyboard. And then we're asked for two values in order to create a user editable text field. The first one is the text that goes inside of the text field when there's nothing in the text field and this will be the word amount. So I'm going to open up some quotes. So by typing one open quote Xcode writes the second closed quote for me. And in here, I'm just going to type amount like that. Next, we need to pass in a value for text. Now this is something interesting because it's a different kind of a value. It's not just what we've looked at…

Contents