Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File listed twice in xcode

I'm working on an iPhone project in Xcode and I'm using github as a repository. Recently, after a series of pushes and pulls from the repository, some of the files in the project are listed twice in Xcode. What I mean by this is that in the left panel of Xcode where it shows all of the files in the project, some of the files are listed twice.

I've done some experiments and the repeated files seem to be merely references to the same underlying file. If I change ViewController.h the same changes appear in the other listed ViewController.h file. Similarly, if I delete on the listed occurences, both of the copies disappear.

I've tried restarting Xcode, deleting the derived data and re-cloning

like image 622
Nosrettap Avatar asked Jan 14 '23 07:01

Nosrettap


1 Answers

The Xcode project browser is just a collection of links to files and/or folders. If you right-click on each instance of ViewController.h and choose "Show in Finder", they will likely both point to the same real file on your computer.

If that's the case, you can safely delete one of them from Xcode without any ill effects. Just make sure to do the default "Remove Reference" and not "Move to Trash".

like image 141
Justin Anderson Avatar answered Jan 16 '23 21:01

Justin Anderson