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


David Mazza
David Mazza
1,253 Points

Blog project: Which class creates a segue object?

This was a really confusing question. It doesn't make sense semantically for UIStoryboardSegue to create an instance of itself.

To make matters more confusing, the documentation says this:

You do not create segue objects directly. Instead, the storyboard runtime creates them when it must perform a segue between two view controllers.

Because this is all Storyboard magic, it is hard to interpret how a segue object is created. The question would have been more clear if it just asked what the name of the class was for a segue.

2 Answers

Hi Amit,

Actually you re-phrased it (adding the word "class") as:

The segue object is an instance of the ___________ class.

This was confusing to me because even though I eventually figured out you were looking for "UIStoryboardSegue" as the direct class, if you look at the hierarchy on this reference page (which talks about segue objects):


..you'll see that the root class for the UIStoryboardSegue class is NSObject (which I thought was the answer at first).

So maybe (to be more specific/targeted) it might say:

The ___________class, which instantiates segue objects, is also responsible for supporting the standard visual transitions available in UIKit.


I don't even know why we even need to know this though, since,

as both David (and the page I provided a link for above) have noted,

everything happens in the background (without usually any manual coding needed):

"You do not create segue objects directly.

Instead, the storyboard runtime creates them when it must perform a segue between two view controllers."

..and of course to initiate a segue programmatically you have to use the performSegueWithIdentifier:sender: method of UIViewController.

...which I don't remember even talked about in the videos.

Oh...and just to provide a link to the quiz that contains this question (which as a 4 part question quiz requires the correct answer to this fill-in-the-blank question to be able to pass the quiz): http://teamtreehouse.com/library/build-a-blog-reader-iphone-app/exploring-the-masterdetail-template/passing-data-to-the-detail-view-2

..if it had been a 5 part question quiz where you could get this question wrong and still pass I wouldn't have even bother to post about this question.

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

You are right. I've re-phrased it to: The segue object is an instance of ____________.