@objc(User)
class User: NSManagedObject {
@NSManaged var id: String
//MARK: - Initialize
convenience init(id: String, needSave: Bool, context: NSManagedObjectContext?) {
// Create the NSEntityDescription
let entity = NSEntityDescription.entityForName("User", inManagedObjectContext: context!)
if(!needSave) {
self.init(entity: entity!, insertIntoManagedObjectContext: nil)
} else {
self.init(entity: entity!, insertIntoManagedObjectContext: context)
}
// Init class variables
self.id = id
}
}