Re: Class instance defaults: e.g. NSBrowser
Re: Class instance defaults: e.g. NSBrowser
- Subject: Re: Class instance defaults: e.g. NSBrowser
- From: Keary Suska <email@hidden>
- Date: Wed, 17 Mar 2010 20:20:27 -0600
On Mar 17, 2010, at 4:11 PM, Andrew James wrote:
> I am a relative newbie to Cocoa so I trying to make sure that my code reflects Cocoa's coding culture.
>
> I'm interested in whether or not instances of Cocoa classes can be expected to display default behavior. I'll use NSBrowser's - (BOOL)sendsActionOnArrowKeys as an example. In Apple's documentation there's no mention of the default.
>
> For my purposes, I want to make sure from release to release that my NSBrowser instance does send an action when up/down keys are used. Does that mean as a Cocoa developer I'm content to always code [ myBrowser setSendsActionOnArrowKeys: YES ] ? or Make sure the appropriate box is checked in Interface Builder?
There is no hard and fast rule that I know of--that is Cocoa-specific. I would assert that as a general rule if you rely on a behavior, then you should always explicitly set it. It disambiguates your code and is future proof in case Apple decides to change the documented default. You may also want to file a bug against the doc.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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