This would probably be better-suited on the Xcode list than here as I think it's a bug in Xcode.
I've had issues when trying out this new CoreData codegen feature. What fixes it for me is to go to: ~/Library/Developer/Xcode/DerivedData and delete the entire directory for the build of my project that is there and then it re-generates everything correctly. HTH, Dave Reed > On Jan 16, 2017, at 1:01 AM, Jean-Denis Muys via swift-users > <swift-users@swift.org> wrote: > > Hi, > > Using Xcode 8.2.1 I just created a brand new document-based Cocoa application > using Core Data and Swift. I created a single entity in the > Document.xcdatamodeld file. I selected "Class Definition" in the CodeGen pop > up menu in the inspector. > > My entity is named PHAudioFile. > > I then asked Xcode to generate the files with the "Create NSManagedObject > subclasses". It generated two files: > > - PHAudioFile+CoreDataClass.swift > - PHAudioFile+CoreDataProperties.swift > > But everything breaks. Building the project, I now get several errors similar > to this: > > <unknown>:0: error: filename "PHAudioFile+CoreDataClass.swift" used twice: > '/Users/jdmuys/Phoenix/PHAudioFile+CoreDataClass.swift' and > '/Users/jdmuys/Library/Developer/Xcode/DerivedData/Phoenix-buxfnwoppzieggdrogkoajdyimri/Build/Intermediates/Phoenix.build/Debug/Phoenix.build/DerivedSources/CoreDataGenerated/Document/PHAudioFile+CoreDataClass.swift' > <unknown>:0: note: filenames are used to distinguish private declarations > with the same name > > More over, the Xcode editor shows many syntax errors in the generated files. > > PHAudioFile+CoreDataClass.swift contains this: > > import Foundation > import CoreData > > @objc(PHAudioFile) > public class PHAudioFile: NSManagedObject { > > } > > With this error on the "public class PHAudioFile" line: > > "Invalid redeclaration of PHAudioFile" > > PHAudioFile+CoreDataProperties.swift starts with this line: > > extension PHAudioFile { > > Which breaks with: > > "'PHAudioFile' is ambiguous for type lookup in this context" > > and of course every line thereafter breaks too. > > Searching for 'PHAudioFile' in my Xcode project, finds only those two files. > In particular I can't find any other declaration for 'PHAudioFile'. > > Am I missing something, or is this broken? > > Thanks, > > Jean-Denis _______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users