Xcode 6 has a ton of bugs. But I'm not quite sure if this is a mistake or not. Perhaps this is not so, because that is what I am currently studying.
My problem is that whenever I try to instantiate my subclass of NSManagedObject, I have no way to pass the entity: NSEntityDescription argument entity: NSEntityDescription and NSManagedContext: insertIntoManagedContext constructor, Xcode says "object" Extra argument "in the call" <
I created a new Xcode project from scratch, just to see if I can recreate the problem in a smaller minimal project.
ToDoList.Item is set as the Item entity class in the data model inspector.
Here is the code:
override func viewDidLoad() { super.viewDidLoad() let appDel: AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate let context: NSManagedObjectContext = appDel.managedObjectContext! let ent = NSEntityDescription.entityForName("Item", inManagedObjectContext: context)!
Here's the subclass:
import UIKit import CoreData class Item: NSManagedObject { @NSManaged var title: String @NSManaged var completed: Bool }
All help is appreciated.
source share