Created
          May 17, 2013 10:09 
        
      - 
      
- 
        Save genkernel/5598209 to your computer and use it in GitHub Desktop. 
    Modern Objective-C Singleton method.
Updated with 'instancetype'.
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | + (instancetype)sharedInstance { | |
| static id instance = nil; | |
| static dispatch_once_t onceToken; | |
| dispatch_once(&onceToken, ^{ | |
| instance = self.new; | |
| }); | |
| return instance; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment