Beginning Collection Views - Part 5: Section 1: | Ray Wenderlich

Add a detail view to your app. Find out how to navigate to a new view when a cell is tapped using Segues in Interface Builder.

This is a companion discussion topic for the original entry at

im running into a brick wall… I have tried everything including starting from your start file you have to download. The final works but when I try to build it from the video I run into a problem. Please watch/build it and tell me if you run into the same error.

What is the error you see? You don’t actually mention the error. It would be helpful to know what the issue you’re seeing is in order to help you :slight_smile:

When you fallow the tutorial it does not work. This is the error I get and I have the proper class set, connections as by the tutorial I believe.

It was working till I changed the “func prepare”

The screenshots aren’t very helpful since they don’t indicate what/where the error is. If you can post the contents of the Xcode console (the window in the bottom left corner) after you have the crash, that should indicate what the issue is.

I think I figured out why your code is failing :slight_smile: For your detail view controller, instead of using a sub-class of UIViewController as per the tutorial, you might have used a sub-class of UITableViewController.

Check the declaration for the view controller - if you check your files listing against the final project you should see that you have a file named DetailTableViewController.swift which seems to indicate that you have a sub-class of UITableViewController and not UIViewController. If you fix that bit, your code should work fine. I followed the tutorial and everything worked fine for me.

All update you on my progress when I get to it tomorrow or the next day. Thank you so much! Do you have a ethereum account? I would like to give you something for helping out so much bud.

Happy to help - I’m part of the team and so it’s all part of the service :slight_smile: That should fix the issue for you but if it doesn’t or if you see any additional issues, just post what you’re seeing and I’ll try to help.

1 Like

Hey bud… got it and ty.

Style question: After falling in love with guards, wouldn’t it be more swifty to use a guard in prepare for segue? Great course!

It is indeed just a matter of personal style in this case would be my opinion since whether you use if let or guard both are about the same level of Swift-y-ness :smiley: Personally, I prefer if let since that is less code and also makes it clear that the rest of the stuff happens only if the if let is successful - but that’s me. You can always use guard if that’s what you prefer :slight_smile:

At the end you added a new check (check for segue identifier), I think that it’s not necessary because you are checking and casting for specific destination controller (and it is unique). :smiley:

@catie Can you please help with this when you get a chance? Thank you - much appreciated! :]