Search code examples
core-dataswift3xcode8

Duplicate files in DerivedData folder using CoreData generator


I'm trying to generate NSManagedModels from my datamodel. Generation works but after I got many errors :

error: filename "Station+CoreDataProperties.swift" used twice: '/Users/Me/MyApp/Models/CoreData/Station+CoreDataProperties.swift' and '/Users/Me/Library/Developer/Xcode/DerivedData/MyApp-gwacspwrsnabomertjnqfbuhjvwc/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/DerivedSources/CoreDataGenerated/Model/Station+CoreDataProperties.swift' :0: note: filenames are used to distinguish private declarations with the same name

I try clean build folder and derivedData directory hard delete. I'm using Xcode 8 BETA maybe it's a bug ?


Solution

  • I get this in Xcode 8.1 For me following steps solved the issue. Please note that order matters.

    1) Create entity in Core Data model.

    2) Under class section, make settings as on following image.

    Module: Current Product Name

    Codegen: Manual/None

    3) Generate your NSManagedObject subclass.

    enter image description here