Re: Protocols and the +initialize class method
Re: Protocols and the +initialize class method
- Subject: Re: Protocols and the +initialize class method
- From: Kevin Meaney <email@hidden>
- Date: Sat, 24 Aug 2013 09:47:55 +0100
Thanks for the feedback everyone.
I was confusing how I was going about doing the necessary initialization to be able implement the protocol in a class. I've been using the +initialize method to do this, but this is as someone pointed out is an implementation detail. So adding +initialize to the protocol is not appropriate and to just leave it up to the developer implementing the class how to achieve the necessary initialization to be able to implement the protocol. I should not be foisting on them how I've been doing it, even when it is just me implementing the classes conforming to the protocol.
My take away is to be reminded to keep implementation details out of the protocol.
Kevin
On 23 Aug 2013, at 20:11, Glenn L. Austin <email@hidden> wrote:
>
> On Aug 23, 2013, at 10:30 AM, David Duncan <email@hidden> wrote:
>
>> On Aug 23, 2013, at 2:49 AM, Kevin Meaney <email@hidden> wrote:
>>
>>> I have a protocol where I would like to include the class method +(void)initialize as being required. This way all classes that conform to the protocol have to implement initialize as part of the protocol. I suppose I'm wondering if anyone perceives any problem with doing this?
>>>
>>> For example, will including +initialize as a required protocol method interfere with objective-c automatically calling the initialize method before the class is used for the first at runtime.
>>
>>
>> What is it that you are actually trying to achieve by doing this?
>
> Especially since *every* class that derives from NSObject will have an +initialize method...
>
>
> --
> Glenn L. Austin, Computer Wizard and Race Car Driver <><
> <http://www.austin-soft.com>
>
_______________________________________________
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