import Foundation import CoreData extesion Note { @NSManaged var creationDate: NSDate? @NSManaged var text: String? @NSManaged var notebook: Notebook? }
import Foundation import CoreData extesion NSManagedObject { convention init(text:String = "New Note", context: NSManagedObjectContext){ if let ent = NSEntityDescription.entityForName("Note", inManagedObjectContext; context){ self.init(entity: ent, insertIntoManagedObjectContext: context) self.text = text self.creationDate = NSDate() } else { fatalError("Unable to find Entity name!") } } }