Created
December 2, 2017 17:45
-
-
Save bouchtaoui-dev/bae774b3cfed33acd0d006f98f9321d8 to your computer and use it in GitHub Desktop.
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
| @interface Singleton : NSObject | |
| @end | |
| @implementation Singleton | |
| + (instancetype)sharedInstance { | |
| static Singleton *sharedInstance = nil; | |
| static dispatch_once_t onceToken; | |
| dispatch_once(&onceToken, ^{ | |
| sharedInstance = [[Singleton alloc] init]; | |
| }); | |
| return sharedInstance; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment