Understanding this use of “(Private)” in @interface declaration

跟風遠走 提交于 2019-12-02 01:40:48

It's a category called 'Private'.

Have a look in the Categories and Extensions chapter of the Objective-C programming reference

What it means is that it is an addition to the AViewControler class that has been named 'Private' for convenience. It could have been called anything or even left blank to create a class extension.

You can create private methods in your own code that your app can call. This is actually good practice because it indicates proper encapsulation (although there is no such thing as a private method in Objective-C). What you aren't allowed to do is to use private methods of the iOS frameworks in your code if you don't want your app rejected from the App Store.

(Private) in this case deals with principles of Object Oriented Programming.

This does not necessarily denote a Private API, which would violate the Apple iPhone Developer Agreement.

Note: App Store approval is very black-box, so I can not guarantee that such code would not indeed result in rejection during the approval process.

Private is just a way to define a category on an object. Does not mean much to Apple but I would recommend using a unique name whenever adding categories to well known libraries such as ones in the FoundationFramework. If your naming convention is a prefix of AV then add a category like this.

@interface AViewController(AVPrivate);

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!