I am trying to set up CoreData
in xcode for an iOS app. I have followed done the following:
- Clicked on project’s .xcodedatamodel file
- Added an entity called “Test”
- Created two properties for that entity, “String” and “Bool” with expected types
- Gone to editor->add NSManagedObject subclass
- This creates “Test+CoreDataClass.swift” and “Test+CoreDataProperties.swift”
- Immediately it throws a slew of errors:
Multiple commands produce ‘/Users/[username]/Library/Developer/Xcode/DerivedData/[appName]-hazcwshuxdzwhsbbtpmbseraaplh/Build/Intermediates.noindex/Previews/[appName]/Intermediates.noindex/[appName].build/Debug-iphonesimulator/[appName].build/Objects-normal/arm64/Test+CoreDataProperties.o’
&
Filename “Test+CoreDataClass.swift” used twice: ‘/Users/[user]/Desktop/[appName]/Test+CoreDataClass.swift’ and ‘/Users/[user]/Library/Developer/Xcode/DerivedData/[appName]-hazcwshuxdzwhsbbtpmbseraaplh/Build/Intermediates.noindex/Previews/[appName]/Intermediates.noindex/[appName].build/Debug-iphonesimulator/[appName].build/DerivedSources/CoreDataGenerated/[appName]/Test+CoreDataClass.swift’
There are ~5 other very similar errors to the first one. I have tried deleting all data in /Users/<user>/Library/Developer/Xcode/DerivedData/
but xcode just ends up recreating these when the simulator is run, and then the errors are thrown again. I have also tried cleaning the build folder and restarting xcode.
Don’t understand what is happening. Why is CoreData’s derived data creating an identical copy of the “Editor->Add NSManagedObject subclass”-created files in a different location? Why does this have the same name? Why is this causing a problem?