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
Louis Sankey
22,595 PointsSubclass UIViewController... or something?
Hi I'm coming from Android and think I'm looking at Xcode and swift wrong still. I installed a custom page navigator with cocoapods (https://github.com/lucoceano/Pager) that lets you swipe left and right and shows you a tab at the top. It seems fairly basic but I'm having trouble.
The first instruction in the ReadMe is "Subclass PagerController (as it's a UIViewController subclass) and implement data source methods in the subclass."
I have a ViewController on the main story board and a ViewController.swift file. The first basic thing I don't understand is how the story board ViewController 'knows' that it corresponds to ViewController.swift. For instance, couldn't I make a new file ViewController2.swift and instead make the story board ViewController correspond to the new file. How do I do that?
That would be a start. But then also I'm having trouble with the github instruction. "Subclass PagerController" Does that mean change UIViewController to PagerController and then create a a file like Pager.swift which is the subclass? Should I also then change the name of ViewController.swift to PagerController.swift? Again, how would PagerController.swift know that it now corresponds to the storyboard PagerController?
Then, does anyone want to show me the code for how Pager.swift would inherit from PagerController.swift?
Am I thinking about this all wrong?
I know maybe it seems like I haven't looked for these answer online, but I honestly have looked a lot over the last three days so now I'm here.
Thanks