[swift-users] Core Data auto-generated Swift files errors?

Jean-Denis Muys jdmuys at gmail.com
Mon Jan 16 00:01:39 CST 2017


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












has this line in error:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170116/f47ca871/attachment.html>


More information about the swift-users mailing list