Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>See Apple's documentation: <a href="https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocCategories.html" rel="nofollow">https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocCategories.html</a></p> <p>It's a class extension, subtly different from a category, since it has no name inside the parentheses. You use it for declaring properties and methods that are intended to be kept private (out of the header), and redeclaring publicly read-only properties and methods as privately read-write. This allows for cleaner encapsulation.</p> <p>By request, a friendly example:</p> <p>JYDuckPondManager.h</p> <pre><code>@interface JYDuckPondManager : NSObject @property (nonatomic, assign, readonly) NSUInteger duckCount; @property (nonatomic, assign, readonly) CGFloat waterLevel; - (JYDuckReaction *)feedDucks:(JYDuckFood *)food; - (JYDuckReaction *)harassDucks:(JYDuckTaunt *)taunt; @end </code></pre> <p>JYDuckPondManager.m (extension, imaginary implementation omitted)</p> <pre><code>@interface JYDuckPondManager () //// Redefined for internal modification @property (nonatomic, assign, readwrite) NSUInteger duckCount; @property (nonatomic, assign, readwrite) CGFloat waterLevel; //// Internally exclusive properties @property (nonatomic, strong) NSSet *duckPersonalitySet; @property (nonatomic, assign) CGFloat flockAnxietyLevel; //// Private messages - (void)recalculatePondState; @end </code></pre> <p>Other objects should be able to interact with the pond, but they're not supposed to know certain things going on in the pond or redefine the pond's statistics. Keeping nuts-and-bolts stuff in the .m extension ensures that the .h is concise and appropriately limited.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload