Most of the time when you have a storyboard segue, you'll need to send some amount of data to the view controller that will be displayed to the user. See how to send that data here in this tutorial.
- [Instructor] Now let's say we want…to pass the current selected item…into the new viewController.…So we're sending data from one viewController to another.…The first thing we'll need to do is create a property…in our viewController class to receive that data.…So this will be called text, so var text…and we'll just set it equal to an empty string there.…Save and return to TableViewController.…And in TableViewController,…we're going to create a variable as well that will represent…the currently selected item.…
So we'll do that right underneath…where we set the items array…and we'll call this currentItem…and this is just going to be a string…and we'll initialize it as well to an empty string.…So let's scroll down,…and I'll just hide the navigator…to get a little bit more space,…and we want to go down to didSelectRowAt IndexPath…where we have the segue being performed.…And here we wanna write some code before the segue,…because we wanna save the currently selected item.…So we receive information about the item…through the indexPath.…
- Installing and using Xcode
- Working with storyboards
- Working with UI objects and events
- Resizing objects and layouts dynamically
- Coding UI objects such as buttons
- Loading and displaying data in table views
- Testing your iOS app
Skill Level Beginner
1. Xcode Fundamentals
2. Core Skills
3. Responsive UI Design
4. Coding UI Objects
5. Table Views
6. App Flow and Testing
Next steps1m 8s
- 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.