Last active
August 29, 2015 14:04
-
-
Save casademora/40b960d49e057ecb3684 to your computer and use it in GitHub Desktop.
Managed Object initializer
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
class CustomObject : NSManagedObject | |
{ | |
init(inContext context:NSManagedObjectContext = SingletonContextStorage.context) | |
{ | |
let klass = CustomObject.self | |
let entity = NSEntityDescription.entityForName(klass.entityName(), inManagedObjectContext: context) | |
super.init(entity: entity, insertIntoManagedObjectContext: context) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because everyone just seems to love singletons... :/