Xcode is looking for core data entity names with dot; not compiling

I have been working on a project for a while, and recently upgraded to Xcode 8 and Swift 3.0 and iOS 10. But since I did that I have not been able to compile.

I am getting an error for each of my entities: :0: error: no such file or directory: ''/Users/mark/Library/Developer/Xcode/DerivedData/.../.Account+CoreDataProperties.swift' Each case has a . (dot) prefix before the entity name: .Account+CoreDataProperties.swift.

I changed the Code Gen from "Category / Extension" to Manual / None, I do a clean and clean directory, an delete the DerivedData directory. Interestingly, when I look in the appropriate directory there is an actual file there, just without the dot prefix.

This is very confusing. Can anyone explain it? I need to solve this to be able to continue with core data.

TIA Mark


The dot files are generated by Xcode8. See WWDC2016. I ran into the same issue after having to delete derived data due to another issue.

Two possible fixes:

1) The recommended, modern approach

  • Delete all generated NSManagedObject subclasses from your project, if exists.
  • Set Codegento Class Definition in your .xcdatamodel for all entities
  • Make sure Module is empty ("Global Namespace" in light gray) (workaround an Apple bug, see @Chris Hansons answer)

  • Clean project
  • Clean DerivedData folder

Note: Even you do not see the generated files in your project, Xcode has a reference to it, so you are able to write extensions and such. For instance:

extension MyEntity {
    func doSomething() {
        //
    }
}

Also, you can command+click to the generated file within Xcode.

2) A rather paranoid but bullet-prove approach, ignoring the new Xcode features

  • Delete all generated NSManagedObject subclasses from your project, if exists.
  • Set Codegento Manual/None in your .xcdatamodel for all entities
  • Clean project
  • Clean DerivedData folder
  • Restart Xcode
  • Manually generate NSManagedObject subclasses (in "Editor" menu)
  • Make sure those files are added to your project
  • build

If your problem persists, repeat:

  • Clean project
  • Clean DerivedData folder
  • Restart Xcode

This occurs when the module of an entity is set to "Current Product Module" (e.g. to be within the Swift namespace, rather than the global Objective-C namespace).

The workaround for this is to remove the customization of the "Module" field of the entity, so it has the default value of "Global namespace" (in light gray text).