Why are there two interface declarations in the default Xcode templates?

More recently, all the new classes that I create in Xcode are preceded by this additional interface in the .m file:

@interface NewViewController () @end 

What does Apple expect from me here and how is it different from the @interface in my .h file?

+4
source share
1 answer

This is an extension. In short, you declare your public public interface in the header and use the class extension to declare any private interface that you want to provide (for example, properties for which you want to access, but which you do not want to publish).

+7
source

Source: https://habr.com/ru/post/1401713/


All Articles