I am trying to create several protocols, and most of them have references to other ones. But I get error during the build process.
I give an example:
#import <Foundation/Foundation.h>
@protocol DataChildDelegate <NSObject>
@property(nonatomic) id<DataParentDelegate> parent;
@end
@protocol DataParentDelegate <NSObject>
@property(nonatomic) id<DataChildDelegate> firstChild;
@property(nonatomic) id<DataChildDelegate> lastChild;
@end
I tried to divide DataChildDelegate in two parts like this:
#import <Foundation/Foundation.h>
@protocol DataChildDelegate <NSObject>
@end
@protocol DataParentDelegate <NSObject>
@property(nonatomic) id<DataChildDelegate> firstChild;
@property(nonatomic) id<DataChildDelegate> lastChild;
@end
@protocol DataChildDelegate <NSObject>
@property(nonatomic) id<DataParentDelegate> parent;
@end
But this time I get a warning.
Is there any more suitable way to handle this problem?
Thanks