I created a test app called Template9b1. The first step I've taken is to use a Template Master / Detail with Core Data. I modified the Entity (called Event) with 4 properties instead of the default "timestamp". I used Create NSManagedObject Subclass, and it created the 2 files as it should.
// Event+CoreDataProperties.swift
import Foundation
import CoreData
extension Event {
@NSManaged var theDate: NSDate?
@NSManaged var name: String?
@NSManaged var favorite: String?
@NSManaged var status: NSNumber?
}
// Event.swift
import Foundation
import CoreData
@objc(Event)
class Event: NSManagedObject {
// Insert code here to add functionality to your managed object subclass
}
When I run it (simulator), I get an error
2015-06-16 23:34:48.842 Template9b1[50760:1014766] CoreData: warning: Unable to load class named 'Template9b1.Event' for entity 'Event'. Class not found, using default NSManagedObject instead.
In the past, to get rid of this type of error, I would put the name of the app "Template9b1" in the module for the inspector of the .xcdatamodeld. But this doesn't seem to get rid of this problem. Also when trying to use it crashes with the following error.
let thisEvent = NSEntityDescription.insertNewObjectForEntityForName(entity.name!, inManagedObjectContext: context) as! Event
Could not cast value of type 'NSManagedObject_Event_' (0x7fa78140b190) to 'Template9b1.Event' (0x10c10b820).
I'm guessing that either the settings for the .xcdatamodeld should be different than they were before, or Event.swift needs something (if it does need something, could I get a lead on what?)