Reputation: 656
inside the singleton methods how should I use a singleton:
like:
[self doMethod];
or:
[[SingletonClass sharedSingleton] doMethod];
?
Upvotes: 3
Views: 608
Reputation: 237110
I can think of no reason to do it the second way. That way is longer, slower and more brittle -- and there's no upside to it. Just use self
unless you have a really compelling reason to do otherwise. Singletons are essentially just normal objects.
Upvotes: 7
Reputation: 16400
I prefer to minimize the number of calls made by the client, so I recommend you have a convenience class method on your singleton that sends the instance method to the singleton.
Upvotes: 1