Xcode build error - Multiple commands produce .o, Target 'ProjectCoreData' has compile command for Swift source files listed twice

Solution 1:

The reason you see this error is because Core Data creates these files by default, but you can't see them in Project Navigator. Then you create a duplicate (in Editor/Create NSManagedObject Subclass). As a result you have your error.

According to What's new in Core Data here is a picture with the solution:

Picture with solution

Solution 2:

For future users : If you are using core data and If you copied entity using option+drag, then ensure that entity name and class name must be same. None of the solutions mentioned over internet worked for me. enter image description here