I’m learning some Objective-C, specifically iOS-related stuff. Whenever I generate a new UIViewController, or UITableViewController, etc, both the generated .h and .m files contain an @interface. The application will continue to compile if I delete the @interface from the .m file, also. What is the purpose of this @interface in the .m file?
I’m learning some Objective-C, specifically iOS-related stuff. Whenever I generate a new UIViewController ,
Share
Technically, it is a “class extension” (see (“Extensions” section of) the Objective-C intro docs). In practice, it has become common to use this as a “private” interface (it is only “visible” to the file in which it exists). Objective-C does not stop anyone else from calling these methods, but they won’t “see” them (think of the .h file as your public interface and this anonymous category as your private interface).
It is handy for declaring
@propertys which you don’t want to expose publicly.