Created
January 15, 2014 01:48
-
-
Save tonyalbor/8429351 to your computer and use it in GitHub Desktop.
implement singleton class
This file contains 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
static DataSource *_sharedDataSource = nil; | |
+ (DataSource *)sharedDataSource { | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
_sharedDataSource = [[DataSource alloc] init]; | |
// further initialization | |
}); | |
return _sharedDataSource; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment