Objective-C accessor declarations (readonly, readwrite, etc)

前端 未结 1 404
逝去的感伤
逝去的感伤 2021-02-01 21:15

In the book, \"Cocoa Design Patterns,\" the author sometimes declares a property in the @interface as readonly:

// .h
@property (readonly, copy) NSArray *shapesI         


        
相关标签:
1条回答
  • 2021-02-01 21:50

    Externally the property will be readonly. While inside the class it will have both the accessor, and the setter.

    The setter will not be visible by the compiler outside of the implementation(.m) file.

    0 讨论(0)
提交回复
热议问题