Why tack a protocol of NSObject to a protocol implementation

前端 未结 5 422
野性不改
野性不改 2020-12-02 23:01

I have been seeing some code around that resembles the following:

@protocol MyProtocol 
// write some methods.
@end

Is ther

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 23:30

    I've never done that in my code, but I could see the advantage to it. If you pass a parameter as id you'll need to re-cast it if you want to call any of NSObject's methods on that object.

提交回复
热议问题