I wrote and downloaded some simple xcode on Cocoa Touch. It is not clear why the default construction is present in the viewcontroller.m file:

 @interface ViewController () @end 

I erased it, the program did not break. After all, .m is responsible for the implementation, not the title. What buns can this design give (take away)?

    1 answer 1

    Briefly: there you can declare hidden methods, properties.

    Details: In Objective-C, classes can be extended by so-called categories. The class itself is declared like this:

     @interface MyObject : NSObject { } - (void)publicMethod; @end 

    And the category is:

     @interface MyObject (MyObjectCategory)// Π½Π°Π·Π²Π°Π½ΠΈΠ΅ ΠΊΠ°Ρ‚Π΅Π³ΠΎΡ€ΠΈΠΈ Π² скобках { } - (void)privateMethod; @end 

    Then, when importing a blank file with a category, you will have access to additional class functionality. A category is usually implemented in a separate file according to the declaration:

     @implementation MyObject (MyObjectCategory)// Ρ‚ΠΎ ΠΆΠ΅ самоС Π½Π°Π·Π²Π°Π½ΠΈΠ΅ - (void)privateMethod { // do smth } @end 

    If a category is declared without a name in the * .m-file, then it should be there and implemented. It turns out that the additional functionality of the class that it declares remains within the framework of the implementation file.

    By the way, there are still categories for separating the implementation of a whole class. You can declare all categories in one procurement file to always be able to use all the features of the class, but to implement categories separately, so as not to sink in tons of code.