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 Working With Multiple View Controllers Master-Detail User Interface

Christine Rose
Christine Rose
6,745 Points

I think I'm using another version of Xcode. The class wasn't UIViewController, & the Cocoa template was quite different

The class is UIView, not ViewController, and I couldn't change it. ViewController wasn't even an option. The second View Controller I added also has the class UIView.

When I added a new file using the Cocoa template (called Cocoa, not Cocoa Touch), the contents were quite different indeed.

What's up?

Jivago Raymond
Jivago Raymond
1,851 Points

Probably because when creating your PlaylistDetailViewController class, you selected the wrong subclass.. IE: You selected "Subclass of UIView" instead of "Subclass of UIViewController". The methods generated with UIView are different.

8 Answers

Hi Christine,

I'm on the up-to-date version of Xcode and don't get the behaviour you describe.

I'm wondering, have you selected iOS rather than OS X on the left? That should give you Cocoa Touch, rather than Cocoa.

Let me know i that helps.

Steve.

Christine Rose
Christine Rose
6,745 Points

I'm sure I selected iOS. The top right says: iOS SDK 8.2, and I'm using the iPhone 5s size because my simulator runs SO SLOW normally, and with iPhone 6, it takes 5 minutes just to load the simulator. Any tips on how to run that faster? I'm working on a rather old MacBook Pro (late 2008) with 4GB RAM. I'm considering an iMac in the near future with 16GB.

I figured out what I was doing wrong on the first bit. In the storyboard, I was selecting the entire storyboard instead of just the yellow View Controller button at the top, so I got that figured out.

Christine Rose
Christine Rose
6,745 Points

Even with the Cocoa Touch, the override func methods still aren't in there they way they are in the video. Maybe I'm doing something else wrong?

Thanks for your help, Steve.

Christine Rose
Christine Rose
6,745 Points

I tried an Android simulator once, and I gave up quickly. Too much for a n00bie like me! So far this at least works and I'm finally seeing the relevance to the coding I've learned by seeing it in action. That's the best thing!

Love StackOverflow. I'll try there. Thanks.

Paulo Braga
Paulo Braga
5,381 Points

I'm having the same problems... When I create the new class PlaylistDetailViewController inherited from PlaylistMasterViewController I do not get it the standard functions (viewDidLoad() and didReceiveMemoryWarning()).

My Xcode version: Version 6.3 (6D570)

Julian Scharf
Julian Scharf
2,007 Points

I also took a wrong turn here.

I made the same mistake by picking OS X (cocoa) instead of iOS (cocoa touch).

Aubrey Taylor
Aubrey Taylor
2,991 Points

I also ran into this. Thanks for the help!

Christine Rose
Christine Rose
6,745 Points

Yep. You're right. When I added the new file, it was OS X, even though the project was iOS. THANKS! !!

My Xcode doesn't tell me about the SDK version - I might have turned that off, though.

I've never had a problem with the iOS simulator - the standard Android one really does take about a week to run a basic 'Hello World' - drives me nuts! I don't if there are any tips to make the iOS one run more quickly. Have a look around in StackOverflow, there's all the answers in there!

As long as you can get your class up and working, that's great!

Steve.