Forward Declarations

suggest change

It’s possible to declare protocol name without methods:

@protocol Person;

use it your code (class definition, etc):

@interface World : NSObject
@property (strong, nonatomic) NSArray<id<some>> *employees;
@end

and later define protocol’s method somewhere in your code:

@protocol Person
- (NSString *)gender;
- (NSString *)name;
@end

It’s useful when you don’t need to know protocols details until you import that file with protocol definition. So, your class header file stays clear and contains details of the class only.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Protocols:
*Forward Declarations

Table Of Contents