9 ms·
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
by lukeredpath 15y ago
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-singletons.html 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?
- alexbell 15y agoThis is cool!