Re:IOS Boilerplate: A base template for iOS apps
by alexbell on Wednesday September 14, 2011 @01:56PM
(#2997207)
This is great so far, you have an excellent taste in frameworks. It's also nice and light weight. I would suggest adding a singleton macro. Will try and put some of the boilerplate stuff I use in as a pull request when I get the time.
[ Parent
| on HN ]
Re:IOS Boilerplate: A base template for iOS apps
by xinsight on Wednesday September 14, 2011 @03:11PM
(#2997469)
I used to love the Singleton (anti-)pattern. It's a huge improvement from using your AppDelegate as a global storage area, but it still encourages sloppy code. I find it the code much cleaner when you pass in the objects a class needs instead of calling up the singleton from all over the place.
There are some legitimate uses for singletons, but if you need a singleton macro, you're probably over using it.
Re:IOS Boilerplate: A base template for iOS apps
by lukeredpath on Wednesday September 14, 2011 @06:50PM
(#2998169)
I'm no fan of singletons either, but writing one with GCD dispatch_once is pretty simple. Nevertheless, I do have a macro for it:
http://lukeredpath.co.uk/blog/a-note-on-objective-c-singleto...
It's really for creating "shared" instances rather than true singletons, but who honestly needs a real singleton?