swift和oc的protocol的成员变量

都需要协议实现者提供具体变量;

否则认为不符合协议。

 

@protocol edddd <NSObject>

@property(nonatomic, strong) NSObject *egooo;

@end

 

Auto property synthesis will not synthesize property 'egooo' declared in protocol 'edddd'

Add a '@synthesize' directive

 

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController egooo]: unrecognized selector sent to instance 0x7fe3c2419b60'

 

protocol Paramsx {

    var param:String{ get set }

}

 

Type 'ViewController' does not conform to protocol 'Paramsx'

Do you want to add protocol stubs?

posted @ 2019-03-08 19:16  zzfx  阅读(708)  评论(0编辑  收藏  举报