<div dir="ltr">Hi,<div><br></div><div>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.</div><div><br></div><div>My entity is named PHAudioFile.</div><div><br></div><div>I then asked Xcode to generate the files with the "Create NSManagedObject subclasses". It generated two files:</div><div><br></div><div><div>- PHAudioFile+CoreDataClass.swift</div></div><div><div>- PHAudioFile+CoreDataProperties.swift</div></div><div><br></div><div>But everything breaks. Building the project, I now get several errors similar to this:</div><div><br></div><div><p style="margin:0px 0px 0px 12px;font-size:11px;line-height:normal;font-family:menlo"><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'</p><p style="margin:0px 0px 0px 12px;font-size:11px;line-height:normal;font-family:menlo">
</p><p style="margin:0px 0px 0px 12px;font-size:11px;line-height:normal;font-family:menlo"><unknown>:0: note: filenames are used to distinguish private declarations with the same name</p></div><div><br></div><div>More over, the Xcode editor shows many syntax errors in the generated files.</div><div><br></div><div>PHAudioFile+CoreDataClass.swift contains this:</div><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)">import</span><span style="font-variant-ligatures:no-common-ligatures"> Foundation</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)">import</span><span style="font-variant-ligatures:no-common-ligatures"> CoreData</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0);min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)">@objc</span><span style="font-variant-ligatures:no-common-ligatures">(PHAudioFile)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)">public</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)">class</span><span style="font-variant-ligatures:no-common-ligatures"> PHAudioFile: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)">NSManagedObject</span><span style="font-variant-ligatures:no-common-ligatures"> {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0);min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">}</span></p></div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div><span style="font-variant-ligatures:no-common-ligatures">With this error on the "</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)">public</span><span style="color:rgb(0,0,0);font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures"> </span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)">class</span><span style="color:rgb(0,0,0);font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures"> PHAudioFile</span>" line:</div><div><br></div><div>"Invalid redeclaration of <span style="color:rgb(0,0,0);font-family:menlo;font-size:11px">PHAudioFile</span>"</div><div><br></div><div><div>PHAudioFile+CoreDataProperties.swift starts with this line:</div></div><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(112,61,170)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)">extension</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span style="font-variant-ligatures:no-common-ligatures">PHAudioFile</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> {</span></p></div><div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"><br></span></div><div>Which breaks with:</div><div><br></div><div>"'<span style="color:rgb(0,0,0);font-family:menlo;font-size:11px">PHAudioFile</span>' is ambiguous for type lookup in this context"</div><div><br></div><div>and of course every line thereafter breaks too.</div><div><br></div><div>Searching for '<span style="color:rgb(0,0,0);font-family:menlo;font-size:11px">PHAudioFile</span>' in my Xcode project, finds only those two files. In particular I can't find any other declaration for '<span style="color:rgb(0,0,0);font-family:menlo;font-size:11px">PHAudioFile</span>'.</div><div><br></div><div>Am I missing something, or is this broken?</div><div><br></div><div>Thanks,</div><div><br></div><div>Jean-Denis</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>has this line in error:<br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>