I know that the question title is not perfectly clear but I don't know how to better explain my doubt.
I found a similar question here but my problem is slightly different:
If I use "generic" id then I lose information about the object I put in the variable and I don't have compile time issue about wrong data types, so I need to change id to NSString for specific classes.
The point is: Protocols are meant to be generic, so, if I define a protocol with this property:
@protocol MyProtocol
@property (nonatomic,strong) id aVariable;
@end
Then I create a class like this:
.h
@interface MyClass : NSObject <MyProtocol>
[...]
.m
@implementation MyClass
@syntetise aVariable = _aVariable;
[...]
@end
The question is: Since I want that the class "MyClass" has a specific type for aVariable
(example NSString) how can I change the type of the protocol's variable implementation for specific classes?
I hope to be more clear with the question now. :)