From the course: Swift: Delegations and Data Sources

Unlock the full course today

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

Destination view controllers in code

Destination view controllers in code

From the course: Swift: Delegations and Data Sources

Start my 1-month free trial

Destination view controllers in code

- [Instructor] You've been looking at a single controller, but no app is a single controller, but a large number of them, and they need to talk to each other. How does the MVC clusters communicate between each other? That's what we'll answer next. In the exercise file for this video, you'll find a code snippet for color chooser. Select and copy the class, then close it back up, and above view controller, paste it. This is another view controller using the same model colors. For the view, instead of a button, it is a segmented control, with the color choices from the color model we made earlier. Right now, all it does is change its own background color. I want my view controller to open the color chooser when I press the button. In that situation, we'll call color chooser a destination controller. There are several ways to navigate from one controller to another. I'll start with the simplest in code, a modal presentation. Go to the view controller class. Comment out what we had in the…

Contents