I have to expose a private property to sub-classes. Since there is no such thing as "protected properties" in objc AFAIK, I'm using the @protected directive to expose the corresponding ivar that's synthesised by the complier.
This method appears to work, however, I'm not sure if I'm affecting the synthesis of the property and ARC in some inadvisable way?
I'm using a weak property here to show how the compiler forced me to use __weak modifier with the @protected directive, i.e. it appears the complier is aware of the two declarations and the link between them.
Superclass .h file
@interface Superclass : NSObject
{
@protected
SCNScene * __weak _scnScene;
}
@end
Superclass .m file
@interface Superclass ()
@property (weak, nonatomic) SCNScene * scnScene;
@end
@implementation Superclass
........
@end
Subclass .m file
@implementation Subclass
// Can use _scnScene just fine
_scnScene = .....
@end