3 ms·
I've received a rejection for using a "private" ivar (it was actually a framework doing it). The ivar was in a public header, and was not marked @private, whic
by natesm 15y ago
I've received a rejection for using a "private" ivar (it was actually a framework doing it).
The ivar was in a public header, and was not marked @private, which is the only correct way to designated an ivar as private in Objective-C. Putting a comment above it saying "this is private" (which they did) doesn't count. It's protected, by definition.
NSActionCell.h, I think.
- chc 15y agoEh, I don't think you're quite right here. @private means "Only accessible by this class and its instances, not parent, sibling or child classes." What Apple means by "private" in that case, though, is "Only for use by Apple, not outside vendors." If NSActionCell has private subclasses that need the variable, marking it @private would be flat-out wrong.
- kelnos 15y agoNo, the correct way to do it in that case would be to mark the ivar as @private, and have a private category on the class with a @property definition for that ivar (or just getter/setter methods). Leaving the ivar as protected and relying on a header file comment is just sloppy. Protected implies that any subclass can use it, not just Apple-blessed subclasses.