Sending data from a collection view controller to another view controller object is done in the same way as it is in a table view. Test your memory and see how sending data works in this brief tutorial movie.
- [Instructor] Now let's pass some data…from the collection view controller…into the other view controller.…So to do that I'm going to head over…to my storyboard to my view controller object…and then I'm going to drop a text view inside of it.…Just like that.…Make it fill the whole width and then shift…option command and equals to add some constraints.…I'll now connect this to my view controller…class using the assistant editor, so option click…view controller dot swift and then right click…and drag from the text field inside of your class…right underneath your class declaration.…
Call it text view and hit return.…Add an extra line of code just for fun…and then we'll return to the standard editor…and to view controller dot swift.…In addition to having a text view property…we're also going to have a current item property.…The data type of this is going to be item info.…Now when we do that it actually says a class…view controller has no initializers.…So because we won't have any item info…when this object is initially created…
- Alert controllers and actions
- Sliders, progress bars, and switches
- Creating UI elements with code
- Displaying web content with Safari view controllers and WKWebView
- Creating collection view controllers
- Creating tabbed apps
- Publishing your app with App Store Connect
Skill Level Beginner
1. Master Views
2. Display Web Content
3. Collection Views
4. Multiview Templates
Customize a table view cell4m 18s
5. Publish an App
Next steps3m 28s
- 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.