I have an Objective-C category that I\'d like to add to multiple classes without duplicating the code contained in the category. I simply want to add the same methods to multipl
maybe it's too late.. But maybe there is one way to do it.. But, you said.. needs to have the same superclass
Category.h
@protocol MyProtocol
- (NSString*)foo;
@end
@interface NSArray (category) @end
@interface NSString (category) @end
Category.m
@interface NSObject (category) @end
@implementation NSObject (category)
- (NSString*)foo
{
return @"bar";
}
@end
I don't like this neither, but it works