From the course: Building a Note-Taking App for iOS 11 with Swift

Unlock the full course today

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

Send data back to the original view controller

Send data back to the original view controller

From the course: Building a Note-Taking App for iOS 11 with Swift

Start my 1-month free trial

Send data back to the original view controller

- [Instructor] Let's take a look at sending data from the detail view controller, back to the master view. Now the reason why we want to do that is because we're going to have the main view controller, actually save the data. Remember that's the class with the save method. So, we're going to start with creating a property on the detail view controller that references that main view controller. So let's head on over to DetailViewController.swift and create a new property. So toward the top right below our text property. And we're going to call this masterView, referring to the main view controller. So the data type is going to be ViewController, and let's make that an implicitly unwrapped optional. So any time we need to reference it, it must be defined. Now on our ViewController class, we want to have a property where we can store the text that was created in the DetailViewController. So remember, when we go to the detailView, that text view is actually editable. So any changes that…

Contents