• 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
Convenience Methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Convenience Methods


  • Subject: Convenience Methods
  • From: Tim Davis <email@hidden>
  • Date: Tue, 25 Sep 2007 21:31:01 -0400


2 quick questions for the guru's here.

1) I've added a convenience method to a class of mine so that it minimizes the init/retains needed to create one just to slap into an array. My question is, in the method should I be returning an object of type (id) or an object that is the type of the class I'm returning? Example:

+ (id)repoWithName:(NSString *)name OfType:(SVNDatabases)type AtPath: (NSString *)path
{
id newInstance = [[[self class] alloc] init];

[newInstance setName: name];
[newInstance setType: type];
[newInstance setPath: path];

[newInstance loadUsers];

return [newInstance autorelease];
}


2) Using this method the object is autoreleased at some later point. If I add this to an array/dictionary etc....does the dictionary automaticly retain an instance or will it still disappear later? Example:

[repositories setObject: [SVNRepository repoWithName: repoName OfType: SVNFSFS AtPath: repoPath] forKey: repoName];


Thanks.

------------------
Dawn's cold passion filters through the trees
In darkness I showed you ecstacy
In darkness I took you from this world
Light shall never fall upon your face again

From spring I've waited for this winter's reap
I've watched you pass autumn's twilight yearning

Now with dawn I bring you eternal sleep
And silence all forever mourning...

_______________________________________________

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


  • Follow-Ups:
    • Re: Convenience Methods
      • From: mmalc crawford <email@hidden>
    • Re: Convenience Methods
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: how to build finalcut-pro style gui apps?
  • Next by Date: Re: Convenience Methods
  • Previous by thread: tableView cell tracking without selection
  • Next by thread: Re: Convenience Methods
  • Index(es):
    • Date
    • Thread