• 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: Singleton or class methods?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Singleton or class methods?


  • Subject: Re: Singleton or class methods?
  • From: Jens Alfke <email@hidden>
  • Date: Sat, 13 Sep 2014 09:51:21 -0700

I would go with class methods. Apple's APIs tend to use instance methods (NSFileManager, NSNotificationCenter, etc.); the benefit of those is that you can have multiple instances with different state (like delegates), or different behaviors. The doesn't seem like it's relevant to your case, though, and it's nice to be able to avoid to write "sharedInstance" all the time.

Straight C functions work too; I also use those for things like this. Pros: they're faster. Cons: the call site is less descriptive.

—Jens
_______________________________________________

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


References: 
 >Singleton or class methods? (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: Singleton or class methods?
  • Next by Date: Loading image resources
  • Previous by thread: Re: Singleton or class methods?
  • Next by thread: Loading image resources
  • Index(es):
    • Date
    • Thread