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 Simple iPhone App with Swift Views and View Controllers View Controllers and IBAction

O Or
O Or
2,761 Points

ViewController "file"?

So I'm thrown off a little bit when he uses the term ViewController "file" (1:28 in the video). Does he mean the ViewController file is an instance of ViewController class? which in turn is a subclass to UIViewController? Just trying to connect that word "file" with what I have learnt so far in Swift.

1 Answer

Omar Nunez
Omar Nunez
4,101 Points

ViewController it is a subclass of UIViewController, when you create a new project you have a default ViewController, but if you notice in your project navigator you will see it is a .swift file, if you clic new file, IOS Source, cocoa Touch class, you can add a new file with the class ViewController, subclass = IUViewController. This would create a ViewController2 in your project. View Controller is a Swift file, subclass = UIViewController.

O Or
O Or
2,761 Points

Ahhh That makes sense! The class and super-class where automatically assigned to the ViewController file created with the project. Thanks a lot!!