I am stuck on this before. This seems to be a real problem, and it wouldn't be painful to write it as a feature request / error with Apple.
In the meantime, you can get around it in two steps. First, tag subclasses of NSManagedObject with @objc(ClassName) . Just add it above the class declaration:
@objc(ClassName) class ClassName: NSManagedObjectSubclass { @NSManaged var name : String }
Second, return to the managed object model and remove the namespace from the class name field in the inspector for the object you are working with.
This worked for me today after reading this: I cannot use my main data model for two purposes in a Swift project
source share