How to handle Objective-C protocols that contain properties?

后端 未结 6 1868
醉梦人生
醉梦人生 2020-12-07 07:56

I\'ve seen usage of Objective-C protocols get used in a fashion such as the following:

@protocol MyProtocol 

@required

@property (readonly)         


        
6条回答
  •  既然无缘
    2020-12-07 08:08

    The variable, anObject, needs to be defined in your TestProtocolsViewController class definition, the protocol is just informing you that it should be there.

    The compiler errors are telling you the truth - the variable doesn't exist. @properties are just helpers after all.

提交回复
热议问题