I have a simple entity in my core data stack (called Diary). This entity has one attribute (name)
I generated the NSManagedObject subclass using the Editor. I also made sure that the class name follows appName.DiaryEntry format
xcode 7 removes the "." and gives me a class with the name: appNameDiaryEntry
Here's the code i am using
let diaryEntry : DiaryDiaryEntry
diaryEntry = NSEntityDescription.insertNewObjectForEntityForName("DiaryDiaryEntry", inManagedObjectContext: dataStoreController.managedObjectContext!) as DiaryDiaryEntry
In the code above, DiaryDiaryEntry is the NSManagedObject subclass that was created from the coredata model.
I get an error saying that
'NSManagedObject' is not convertible to 'DiaryDiaryEntry'
If i force a downcast using as!, it works but i get an error during run time (because the value was nil and was force unpacking?)
Any ideas how to fix this? Thanks, Karthik