From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

TextEditor and Scribble

TextEditor and Scribble

- [Instructor] There's two new features in iOS 14 that I'm finding very exciting. The text editor object in SwiftUI and scribble, together you can do a lot with just a little code. I've put together a small SwiftUI app of a button and text. And it's just going to display the text that you find up in the state variable up here. And there's a special string that I created, a clear string, which will clear that text if you hit the button. So that's all I've done so far. What I'm going to do, is I'm going to add a text editor. And that's very easy to do. I'm just going to come down here, scoot up a little so you can see this. And I'm going to put in here TextEditor. It's got a parameter text, and then you put dollar sign text. It takes a binding variable. That binding variable of course is our state variable. So what it will do is when this changes, it'll redraw, and it'll put that text into the text on the top of our…

Contents