Private property, "package" setter
I'm trying to hide the setter of a @property for a header I'm making
publicly available in a framework I'm building:
//File: X.h
@interface X
@property (nonatomic,readonly, strong) NSString* identifier;
@end
I have a category that adds some methods to this interface:
//File: X+implementation.h
@interface X (Implementation)
...
@end
This category is only accessible under my project, i.e. I'm not making it
public it when I'm building the framework. Many sources say that I should
add a interface extension with the readwrite property, but this is useless
since my category wont be able to see the readwrite definition on "X.m".
So I thought to add it on the category declaration:
//File: X+implementation.h
@interface X ()
@property (nonatomic, readwrite, strong) NSString* identifier;
@end
//same file
@interface X (Implementation)
...
@end
this compiles but gives me a [X setIdentifier:]: unrecognized selector
sent to instance
I've tried to replicate the extension on X.m, to manually create the
setters under X.m, to manually @synthesize the variable but none of those
seems to work. What should I do in this case?
No comments:
Post a Comment