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
From the course: Building a Note-Taking App for iOS 11 with Swift
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…
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.
Contents
-
-
-
-
-
-
-
-
Set a delegate for the table view3m 22s
-
Transition to a second view controller7m 11s
-
Create a custom class for a view controller3m 41s
-
Send data to the second view controller7m 50s
-
Send data back to the original view controller7m 34s
-
Show and hide the software keyboard2m 18s
-
Change title sizes2m 7s
-
-