Data can be sent to and from multiple view controllers in iOS 10 by using Swift 3. This tutorial shows how to send data back from the second view controller to the original view controller.
- [Instructor] So, now that we've looked at…sending data to the Detail View Controller,…let's look at sending it back to the Main View Controller.…Now, to do that we're going to need a few different things.…Number one, I'm going to need a reference…to the Main View Controller…inside of my Detail View Controller class.…So, I'll create a new variable in there…and I'm going to call that master view,…and that's going to be a View Controller.…I'm also going to make it an implicitly unwrapped optional.…
So, I'll add that exclamation point.…Next, I'm going to need a property on the master view…that holds the text that was changed,…so if I edit the text field,…when I'm editing my note I want to make sure…I have that edited text saved…and sent back to View Controller.…So, I'm going need a property for that.…I'll go back to ViewController.swift,…scroll up to the top…and create a new variable.…
I'm going to call this newRowText.…That's going to be a string…and I'll initialize to an empty string.…So now, what I want to do is set that master view property…
In this course, join Todd Perkins as he takes you through how to create cross-platform apps using Swift. This course is one of three related courses designed to help you discover the similarities and differences that exist between the platforms used by three main devices: an Android phone, an iPhone, and a Windows phone. These courses use the same assets to create the same note-taking app so that you can identify and experience the complementary and contrasting development steps.
- Downloading Xcode
- Configuring preferences in Xcode
- Building the app interface
- Connecting interface elements to code
- Writing app logic
Skill Level Intermediate
1. Project Overview
A demo of the finished app1m 19s
2. Understanding iOS Specifics
3. Get Started
4. Create the Table and a Data Source
5. Edit and Save Data
6. Work with Multiple View Controllers
Next steps2m 1s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.