Re: question about informal protocols
Re: question about informal protocols
- Subject: Re: question about informal protocols
- From: Jean-Daniel Dupas <email@hidden>
- Date: Fri, 20 Nov 2009 21:21:22 +0100
Le 20 nov. 2009 à 21:09, Michael de Haan a écrit :
>>
>>
>> The usual way is to NOT implements the NSObject category and test if the delegate implements the method using -respondsToSelector:
>> But this way works too if you don't want to have to test before sending your message.
>>
>> Anyway, informal protocols are "deprecated" in favor of @protocol with @optional method.
>>
>>
>> -- Jean-Daniel
>>
>>
>>
>>
>
>
> Did not see that it was deprecated, but will take your lead and convert them to that. Does the, in your opinion, "optional" addition pretty much replace categories as a whole, or is there still a role for them?
>
They are not formally deprecated (that's why I used quotes), but Apple replaced most if not all Cocoa informal protocols in 10.6 and there is no reason to use them anymore.
@optional replaces categories used as informal protocol, but this is not the only usage for categories. They are very useful if you want to add a method to an existing class.
-- Jean-Daniel
_______________________________________________
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