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 Modifying the UI

Mit Sengupta
Mit Sengupta
13,823 Points

Why am I unable to find “destinationViewController” tied with AnyObject instead of UiViewController in the xCode 7.2?

Here's my code snap:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showPlayListDetail" { let playListDetailController = segue.destinationViewController as! PlaylistDetailViewController
playListDetailController.segueLabelText = "Yay! You pressed the button!"
} }

1 Answer

Steven Deutsch
Steven Deutsch
21,046 Points

Hey Mit Sengupta,

Did you give your segue an identifier name? It has to have the same name, "showPlaylistDetail", that you use in your prepareForSegue. You can check this by clicking on the segue in the storyboard and then going to the attributes inspector.

Hope this helps.

Mit Sengupta
Mit Sengupta
13,823 Points

Hey Steven, thanks for pointing that out!

I just rectified it and now both have the same name. However, I'm still getting "destinationViewController" tied with UiViewController" instead of being tied to "Any Object".

Steven Deutsch
Steven Deutsch
21,046 Points

Mit Sengupta , go to your storyboard, click on your detail view, then go to the identity inspector (this is to the left of the attributes inspector), and make sure under class it says PlaylistDetailViewController. If not, add it. Also is the module Current- Algorhythm ? Sorry for the slow reply, treehouse isn't giving me any notifications.

Mit Sengupta
Mit Sengupta
13,823 Points

Hey Steven, you were right. It wasn't set. So I tried to set the under class to PlaylistDetailViewController and module to Current Algorithm but without success. Every time I am trying to set it by pressing ENTER it bounces off with a beep.

Steven Deutsch
Steven Deutsch
21,046 Points

Is your file named PlaylistDetailViewController? Inside of the file is it declared as PlaylistDetailViewController: UIViewController? Also, is that file in your Algorhythm folder? It needs to be in the same folder as all your other files.