Skip to content

Protocol

Silver edited this page Aug 11, 2020 · 1 revision

Same to Objective-C

Example:

//it will create a Protocol named 'Protocol1' in runtime
@protocol Protocol1 <NSObject>
@property (nonatomic,copy)NSString *name;
-(NSUInteger)getAge;
-(void)setAge:(NSUInteger)age;
@end
@protocol Protocol2 <Protocol1>
- (void)sleep;
@end
Clone this wiki locally