karl_m
karl_m

Reputation: 85

Can't find model CoreData + Swift

I have a problem when running an application on xcode for iphone 6. I created the project a while ago but didn't check the Use CoreData option since the development team was gonna use another database framework. I tried adding the extra code on the AppDelegate.swift file to use CoreData but the model for the project is not existant. Is there a way for me to create the model now? The exception happens in the managedObjectModel section of the file:

    lazy var managedObjectModel: NSManagedObjectModel = {
       // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
       let modelURL = NSBundle.mainBundle().URLForResource("Tiempos", withExtension: "momd")!
       return NSManagedObjectModel(contentsOfURL: modelURL)!
    }()

Upvotes: 1

Views: 629

Answers (1)

Marcus S. Zarra
Marcus S. Zarra

Reputation: 46728

The model is just another source file in your project. In Xcode use File -> New -> File and then under Core Data you will be able to select a model file.

Upvotes: 0

Related Questions