Re: How to write a "function" in Cocoa?
Re: How to write a "function" in Cocoa?
- Subject: Re: How to write a "function" in Cocoa?
- From: Scott Stevenson <email@hidden>
- Date: Sat, 4 Nov 2006 01:28:09 -0800
On Nov 4, 2006, at 12:56 AM, Joel Norvell wrote:
// MyRectUtilities.h
#import <Cocoa/Cocoa.h>
@interface MyRectUtilities
- (NSString *) rectString:(NSRect) rectBounds;
Since there are no instance variables involved, you should make this
a class method or even just a simple C function.
In terms of style, you probably want to call it "stringFromRect". The
first part of the method name should describe what is returned, and
the last part should describe the parameter.
One of these would be good:
@interface MyRectUtilities
+ (NSString *) stringFromRect: (NSRect)rect;
@end
NSString * stringFromRect (NSRect rect);
Some tutorials on style:
http://cocoadevcentral.com/articles/000082.php
http://cocoadevcentral.com/articles/000083.php
Finally, it looks like your method does something different, but I
assume you're aware of NSStringFromRect() in Foundation's NSGeometry.h?
Hope that helps,
- Scott
_______________________________________________
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