From the course: Swift: Delegations and Data Sources
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
View
- [Instructor] If the model does nothing with interaction, where is all the user interaction? That's happening in the view. Let's add a view to our playground. Under the class, add this, and give yourself a little bit more room, so I'm adding a couple extra lines here, to soup this up a little, and I'm going to start with let view equal UIView, and I'm going to use the one for frame, so I can make a frame here, and CGRect, let me just the integer one, and that will be zero, zero, width of 400, and I'll make a height of 600. And that makes us a view, and we're going to do a PlaygroundPage.current.liveView equals the view, and that displays the view on our live view that we'll use to see what we're doing here. Now I can change the background color to orange. So I can do view.backgroundColor equals UIColor.orange, go ahead and run this, and if I check my live view, I've got an orange box now. That's a view, but it's kind of boring. So I'm going to close up my live view again, and I'm…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.