Last active
August 29, 2015 14:02
-
-
Save jkhowland/89e24b5fb6e1b5048eb5 to your computer and use it in GitHub Desktop.
Creating a task controller singleton for a task controller
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
// This goes in the header file | |
+ (EntryController *)sharedInstance; | |
// This goes in the implementation file | |
+ (EntryController *)sharedInstance { | |
static EntryController *sharedInstance = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sharedInstance = [[EntryController alloc] init]; | |
[sharedInstance loadFromDefaults]; | |
}); | |
return sharedInstance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment