Re: Xcode warns about missing protocol definition, even though @protocol is used
Re: Xcode warns about missing protocol definition, even though @protocol is used
- Subject: Re: Xcode warns about missing protocol definition, even though @protocol is used
- From: Kyle Sluder <email@hidden>
- Date: Thu, 03 May 2012 15:34:51 -0700
On May 3, 2012, at 3:33 PM, Quincey Morris wrote:
> On May 3, 2012, at 15:13 , Kyle Sluder wrote:
>
>> Except the compiler produces the warning on the @interface, which provides no information about whether the class actually implements the required protocol methods. You don't need to redeclare methods from protocols you adopt. The logical place to emit this warning is on the @implementation, so the compiler can alert you that it can't verify you've _implemented_ all the methods you claim to.
>
> As an aside, the second kind of information that the compiler needs is the inheritance chain for the protocol.
>
> The idea that the actual protocol declaration (as opposed to the forward reference) belongs with the implementation ignores the fact that the public @interface is all that clients of the class have to go on, and clients of the class typically need to know what methods form part of the protocol (and need to know the inheritance chain).
This is true; I hadn't thought about that. Especially since current advice is to make all your protocols conform to <NSObject>.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden