Home > Mobile >  XCode 13 unable to remove code lines after deleting Derived data
XCode 13 unable to remove code lines after deleting Derived data

Time:09-29

I deleted Derived data of project and after that I can't remove any line of code in the project. The moment I delete any character in function, XCode 13 is duplicating that line as seen in the below image.

enter image description here

And I can't delete even a comment. The code doesn't even build now. What do I do?

A big chunk of commented code I tried to delete, it deletes but then shows that deleted code again upwards in another function.

CodePudding user response:

Your screenshot is showing the inline comparison view, which shows version control changes inline in Xcode's editor. The inline comparison view is confusing if you're used to the side by side comparison view. The top line of code shows the old version of the code. The second line shows the current version of the code. When you delete code the deleted code remains when the inline comparison view is on because the deleted code is the old version of the code.

If you don't like the inline comparison view, you can get rid of it using the buttons on the right side of the document tab list, which is above the editor and below the project window toolbar.

enter image description here

Clicking the left (blue) button in the screenshot turns off showing version control changes in the editor. Clicking the middle button and choosing Side by Side Comparison will show the changes in two separate editors side by side.

  • Related