Data can be sent to and from multiple view controllers in iOS 10 by using Swift 3. This tutorial shows how to send data from one view controller to another.
- [Instructor] So we have our ViewController…and it has a table and we have our DetailViewController…and it has a a textView.…But we don't have any way to tell the DetailViewController…which row was selected in the table…in the original ViewController.…So let's look at how to set that up.…To start, I'm going to create a text property…in the DetailViewController object.…So right underneath the textView variable,…I'm going to create a variable called text,…and that'll be a string, and I'll set it…equal to an empty string.…
Now in viewDidLoad I'm going to change textView.text…to the value of text.…And below viewDidLoad I'm going to create…a new method called setText.…And this is going to be used for changing the text…from the other ViewController.…Call func setText,…and will receive some text…that's a string, so t is a string…and it doesn't return anything.…
And we're going to set text = t.…And then we're going to set textView.text = t.…The thing is that setText might be called…before viewDidLoad and so we only want to…
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.