Objective-C categories: Can I add a property for a method not in my category?
Posted
by Squeegy
on Stack Overflow
See other posts from Stack Overflow
or by Squeegy
Published on 2010-03-26T02:48:19Z
Indexed on
2010/03/26
2:53 UTC
Read the original article
Hit count: 308
I want to use a category to make a method on the original class available as a property as well.
Class A:
@interface ClassA
- (NSString*)foo;
@end
Class A category
@interface ClassA (Properties)
- (void)someCategoryMethod;
@property (nonatomic, readonly) NSString *foo;
@end
Now when I do this, it seems to work, but it gives me warnings because I am not synthesizing the property in my category implementation. How do I tell the compiler everything is actually just fine since the original class synthesizes the property for me?
© Stack Overflow or respective owner