==> Here One Protocol Declared :
@protocol MyProtocol <NSObject>
=> Declared One Of the Method :-
- (void)aRequiredMethod;
=> Here Required Method:
@required
- (void)anotherRequiredMethod;
@optional
- (void)anOptionalMethod;
@end
@interface MyClass <MyProtocol>
@end
@property (nonatomic, weak) id<MyProtocol> delegate;
[self.delegate aRequiredMethod];
[self.delegate conformsToProtocol:@protocol(MyProtocol)]
[self.delegate respondsToSelector:@selector(anOptionalMethod)]
@protocol MyProtocol <NSObject>
=> Declared One Of the Method :-
- (void)aRequiredMethod;
=> Here Required Method:
@required
- (void)anotherRequiredMethod;
@optional
- (void)anOptionalMethod;
@end
@interface MyClass <MyProtocol>
@end
@property (nonatomic, weak) id<MyProtocol> delegate;
[self.delegate aRequiredMethod];
[self.delegate conformsToProtocol:@protocol(MyProtocol)]
[self.delegate respondsToSelector:@selector(anOptionalMethod)]