I am trying to translate my code from Objective-C to Swift but for NSManagedObjectModel
I get this error:
Use of undeclared type NSManagedObjectModel.
The code in Objective-C:
NSManagedObjectModel *managedObjectModel;
NSManagedObjectContext *managedObjectContext;
NSPersistentStoreCoordinator *persistentStoreCoordinator;
I translated to Swift:
var managedObjectModel: NSManagedObjectModel?
var managedObjectContext: NSManagedObjectContext?
var persistentStoreCoordinator: NSPersistentStoreCoordinator?
Is it right?
You're missing the import for CoreData. Put this in the top of your file to the other import
statements:
import CoreData