I'm new to objective-C, so apologies if this is repeated somewhere. I have a category(?) that is something like:
inside SomeClass.h
:
@interface SomeClass (SomeCategory) <SomeDelegate>
@property (nonatomic, retain) id somePublicProperty;
@property (nonatomic, retain) id someProperty; // <-- i want to move this to "private"
@end
and now in my SomeClass.m
, all i have is:
@implementation SomeClass (SomeCategory)
// dynamic setters/getters here for someProperty.
@end
I think the someProperty
is public. how do i make this "private"? (in other words, how do i syntactically put this in the .m
file? i tried to use
@interface SomeClass (SomeCategory) {
@property (nonatomic, retain) somePrivateProperty;
}
@end
but it just complains that i have duplicate definition of the category. how do i do this correctly?
Just add the category definition in the .m file OUTSIDE the implementation block
Like so:
@interface MyClass (MyCategory)
@property (assign) BOOL myPrivateProperty;
@end
@implementation MyClass
...
@end