I need to have property in class that is excluded from public framework headers, but it is available for use internally in other framework classes. What I did right now is:
MyClass.h:
@interface MyClass: NSObject
@end
MyClass+Internal.h
@interface MyClass (Internal)
@property (nonatomic, copy) NSString *mySecretProperty;
@end
MyClass.m
#import "MyClass.h"
#import "MyClass+Internal.h"
@interface MyClass ()
@property (nonatomic, copy) NSString *mySecretProperty;
@end
@implementation MyClass
@end
And I can use private property like:
MyOtherClass.m:
#import "MyClass.h"
#import "MyClass+Internal.h"
@implementation MyOtherClass
- (void)test {
MyClass *myClass = [MyClass new];
NSLog(@"%@", myClass.mySecretProperty)
}
@end
But what I don't like about this setup is that I have duplicate declaration of property in my Internal
Category and inside of anonymous Category.
Is there a way to improve this setup?