Krekin Krekin - 1 year ago 115
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?

Answer Source

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

@interface ClassName ()

@property (nonatomic, strong) NSArray *myproperty;


@implementation ClassName

@synthesize myproperty;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download