I have a viewController (lets call it vcA) and this viewController has a NSArray property declared and synthesized.
NSArray *myProperty;
...
@property (nonatomic, retain) NSArray *myProperty;
and then synthesized on .m
this vcA is a delegate for another viewController, vcB.
Inside vcB I do:
NSArray *getMyPropertyFromDelegate = (NSArray *)[delegate myProperty];
and I receive an error saying warning: Semantic Issue: Instance method ‘-myProperty’ not found (return type defaults to ‘id’)
I know I can silent this warning changing the line to
NSArray *getMyPropertyFromDelegate = (NSArray *)[(vca*)delegate myProperty];
and importing vcA.h, but I am trying to make vcB as independent as possible, because the delegate can change.
How do I do that working just with the delegate property?
thanks
I suggest you write a custom protocol.
Make
vcaview controller conforming to the protocol, and invcB, declare the delegate property :This means the delegate can be any type, as long as it conforms to
MyProtocol.Here is an example.