I am trying to write a convenience method for creating new object types in CoreData. I have my managedObjectContext
defined at global level in another file.
This is what my code looks like:
class Room: NSManagedObject {
class func createNew() -> NSManagedObject {
return NSEntityDescription.insertNewObjectForEntityForName("Room", inManagedObjectContext: managedObjectContext!) as? NSManagedObject
}
}
Where I am calling managedObjectContext
I get an error. It says
Room.Type does not have a property named managedObjectContext
Yet that is not where I want to look for this data. It even appears in the auto-complete correctly and then only breaks after completing.