Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode 13 unable to remove code lines after deleting Derived data

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.

like image 938
Deepak Sharma Avatar asked Apr 27 '26 03:04

Deepak Sharma


1 Answers

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.

like image 130
Swift Dev Journal Avatar answered Apr 29 '26 20:04

Swift Dev Journal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!