How to make a real private instance variable?

后端 未结 7 837
悲&欢浪女
悲&欢浪女 2020-11-28 04:33

I want to make an instance variable that can\'t be accessed from outside. Is something like that possible in objective-c? I remember Apple has private variables and stuff li

7条回答
  •  醉话见心
    2020-11-28 05:11

    I saw the following usage in a sample app (PaintGL) by Apple

    In .m file

    @interface MyClass (private)
      - (void) privateMethod();
      @property(...) myProperty;
    @end
    

    Disclaimer: The sample app only has method declarations, I saw the private property declaration in this SO thread

提交回复
热议问题