Controlling Custom Views
In the swift course, building a vending machine app chapter, controlling custom views lesson/video, Pasan creates a new a view controller and creates a cocoa Touch class. He then gives it the sub class DepositController.
My question is, why doesn't he use a swift file for this? He never explained why he chose a cocoa touch class.
Michael HuletTreehouse Moderator 47,610 Points
He did use a Swift file, he was just implementing a subclass of a Cocoa Touch class within it. The language he's using to write is Swift, but the iOS SDK (all the stuff in Founation/UIKit/etc. like
NSAttributedString/etc.) is called Cocoa Touch. In Xcode, the "Swift file" template provides you with a blank Swift file, but the "Cocoa Touch class" template provides you with a mostly-blank Swift (or Objective-C, if you want) file with a basic class/subclass already defined. There's really no technical difference between the two besides the fact that the "Cocoa Touch class" template fills in a bit more for you to start so you don't have to write it yourself
That makes complete sense. Thank you for taking the time to provide such a thorough answer.