I am getting this error that seems to warn me of duplicate files. Am I missing something or Xcode now doesn't require creating nsmanaged subclass to operate on core data. I tried creating a blank project and the same thing happens. Here is the error data
<unknown>:0: error: filename "Card+CoreDataClass.swift" used twice: '/Users/user/Documents/Developer/coredata/Card+CoreDataClass.swift' and '/Users/user/Library/Developer/Xcode/DerivedData/coredata-gicbdltjgiidbcfxaqqaxvkqwnnk/Build/Intermediates/coredata.build/Debug-iphonesimulator/coredata.build/DerivedSources/CoreDataGenerated/coredata/Card+CoreDataClass.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name
<unknown>:0: error: filename "Card+CoreDataProperties.swift" used twice: '/Users/user/Documents/Developer/coredata/Card+CoreDataProperties.swift' and '/Users/user/Library/Developer/Xcode/DerivedData/coredata-gicbdltjgiidbcfxaqqaxvkqwnnk/Build/Intermediates/coredata.build/Debug-iphonesimulator/coredata.build/DerivedSources/CoreDataGenerated/coredata/Card+CoreDataProperties.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name
Command /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
This implies to me that the files have already been automatically created. I can even make a Card object without manually creating the subclasses. Thanks.
The issue here is that as of Xcode 8, new projects using Core Data and new Core Data data models are configured to use automatic code generation by default. That means you don’t have to explicitly generate code for your Core Data entities any more, Xcode will take care of that for you. If you leave automatic code generation on and also manaully generate Swift classes for your entities, you’ll see an error like this.
You can disable automatic code generation for an entity in the entity inspector, or you can remove the manually-generated code from your project. Either of the two should fix this.
Try clearing your derived data via Xcode > Preferences > Locations > little grey arrow > move contents to the trash. Then clean the project and rebuild.
First check in you project that you have not imported this file Card+CoreDataProperties
twice, also check that you have not created this class Card+CoreDataProperties
twice throughout your project, also delete derived data and clean your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With