Krekin Krekin - 9 months ago 68
Objective-C Question

Public property not subclassable

Is there a way to prevent a class's public @property from being available to subclasses of that class?

Currently, I have a class and its subclass. The subclass uses a lot of its parents properties, but there are a few properties that I want only the parent to own: to the point that the subclass wouldn't even be able call upon these restricted properties when writing code.

Long story short, this would make using the class & any of its subclasses "safe".

Is it remotely possible?


You make a property private by declaring it in .m file

@interface ClassName ()

@property (nonatomic, strong) NSArray *myproperty;


@implementation ClassName

@synthesize myproperty;