• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: convenience methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: convenience methods


  • Subject: Re: convenience methods
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 4 Apr 2005 03:28:23 +0200


On 4.4.2005, at 3:11, Julien Palmas wrote:

I've been wondering how to write a convenience class methods.
I've got an implementation that works, but wanted to know if it was the right way to do it ...


what about this to add a new color to the NSColor class ?

+ (NSColor *)lightRedColor {
return [[NSColor colorWithCalibratedHue:0.0 saturation:0.1 brightness:1.0 alpha:1.0] autorelease];
}


is that ok ?

Definitely. Excellent implementation. (Well it is slightly arguable whether to use [NSColor color...] or rather [self color...], but the difference is, from the practical point of view, rather academic anyway.)


Just one caveat: method names are--in shared classes, like here--global, so with names like this you risk a conflict with other's library. Depending on the environment the code will be used the risk may be negligible or important, that can't be judged.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: convenience methods
      • From: Ondra Cada <email@hidden>
References: 
 >convenience methods (From: Julien Palmas <email@hidden>)

  • Prev by Date: Re: Split view in a table
  • Next by Date: Re: convenience methods
  • Previous by thread: Re: convenience methods
  • Next by thread: Re: convenience methods
  • Index(es):
    • Date
    • Thread