Error creating NSManaged Subclass in Xcode 8.2 beta

I get this error, which seems to warn me about duplicate files. I missed something, or Xcode now does not require creating an nsmanaged subclass for working with master data. I tried creating an empty project, and the same thing happens. Here are these errors

<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 means that files are already created automatically. I can even create a Card object without manually subclassing it. Thanks.

+6
source share
3 answers

The problem is that with Xcode 8, new projects using Core Data and new Data Data models are configured to use automatic default code generation. This means that you do not need to explicitly generate code for your Core Data objects, Xcode will take care of this for you. If you leave automatic code generation and manaully create Swift classes for your objects, you will see an error like this.

You can disable automatic code generation for an object in the object inspector or remove manually generated code from your project. Any of the two should fix this.

+7
source

Try clearing the derived data with Xcode> Preferences> Location> little gray arrow> move contents to trash. Then clean the project and rebuild.

+1
source

First, verify in the project that you have not imported this Card+CoreDataProperties file Card+CoreDataProperties , also verify that you have not created this Card+CoreDataProperties twice throughout the project, also delete the derived data and clear your project.

+1
source

Source: https://habr.com/ru/post/1012070/


All Articles