Objective-C Protocol Forward Declarations

前端 未结 4 1992
心在旅途
心在旅途 2020-12-03 00:31

ObjectProperties.h

@protocol ObjectProperties 

@property (strong, nonatomic) NSString *name;
@property (strong, nonatomic) NSDate *         


        
4条回答
  •  星月不相逢
    2020-12-03 01:04

    Since you're declaring conformance to the protocol, you should #import the header containing the protocol.

    This is the same as #importing a superclass, rather than forward declaring it:

    @class Foo;
    
    @interface Bar : Foo
    // Will get error: attempting to use the forward class 'Foo' as superclass of 'Bar'
    @end;
    

提交回复
热议问题