Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Playlist Browser with Swift Using a Navigation Controller With Segues Passing Information Between Views

David Maybach
David Maybach
2,092 Points

Sorry for the silly question but why do we want to learn passing data thru segues?

I'd just like to understand it on a real app example.

Is this for something like pressing on a thumbnail picture or comment on Instagram or Pinterest and the information from that picture being pushed to a full size view on the hierarchy view controller? Something like that?

1 Answer

Jhoan Arango
Jhoan Arango
14,575 Points

Hello David:

Sometimes you need to get information in one viewController to the other. For example, I recently made a simple app, that flight attendants use to do a passenger count.

https://itunes.apple.com/us/app/pax+/id1004806430?ls=1&mt=8

In this app, the second viewController had the value of the capacity of the aircraft, and I needed to get that information to the first viewContoller, and for that I needed a segue. You can check out my app, and try it, you’ll understand one of many examples that you may need a segue.