You can define the synthesized property "private" (put this in your .m file)
@interface ClassName () // Declared properties in order to use compiler-generated getters and setters @property (nonatomic, strong <or whatever>) NSObject *privateSomeObject; @end
and then manually define the getter and setter in the "public" part of ClassName ( .h and @implementation part), like this,
- (void) setSomeObject:(NSObject *)someObject { self.privateSomeObject = someObject;
Now you can access the someObject "property, as usual, for example. object.someObject . You also get the advantage of automatically generated retain / release / copy , compatibility with ARC and almost no loss of thread safety.
source share