Advertisement
priore

How to use GDC for create a singleton class

Apr 5th, 2013
900
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. + (id)sharedInstance
  2. {
  3.     static dispatch_once_t once;
  4.     static id instance;
  5.     dispatch_once(&once, ^{
  6.         instance = self.new;
  7.     });
  8.     return instance;
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement