Where is the Xcode side by side code comparison option?
Asked Answered
T

3

38

Since Xcode 13, code comparison default is no longer a side-by-side diff.

There must be a way of doing this still.

I am struggling to find the option!

Thoer answered 21/9, 2021 at 16:3 Comment(3)
I don't want to edit your post, but would like to suggest you add the phrase "side-by-side diff" in it - I only tripped on this because I deleted 'diff' and searched again. Maybe multiple phrases: "side by side git diff", "side by side diff", "side-by-side diff", "side by side code diff". Hmmm - maybe this comment will do that - will try again later.Henleyonthames
I used to search this with "Enable Version Editor in Xcode 13" query - got nothingHiphuggers
There used to be two buttons to cycle through the differences - the buttons where in the bottom center in the Side by Side window. Where did these go in Xcode 14?Aurlie
C
66

Click on Code Review (the blue button on the screenshot), the one with one arrow to the left and the other one to the right (or in View Menu).

Then, on the second icon, select Side by Side Comparison instead of Inline Comparison (or in Editor Menu).

"Commits list" is at the bottom, on the bar with Enable Breakpoints, etc.

enter image description here

Conrado answered 21/9, 2021 at 16:11 Comment(10)
I am aghast that this answer hasn't gotten up voted 1000 times!!! Saved my life!Henleyonthames
The "second icon" Larme is referring to is the one with the five horizontal lines.Mistake
You can bring up the option to discard a code change by tapping the blue bar in the gutter to the left of the change.Mistake
@P.Stern Didn't find that :(Tamarra
@Tamarra - If you are referring to the button with five horizontal lines, it doesn't appear until after you click on the button with right and left arrows. If you are referring to the blue bar, it appears to the left of the line number when you change a line of code. If you select the blue bar, a menu comes up with the option to "Discard Change".Mistake
@P.Stern I can't find the blue bar!!! It used to exist in all previous Xcode versions but not in Xcode 13.0Tamarra
@P.Stern I found it now. It only appears when I have non-committed local changes. It used to appear even comparing comitted changes to older commits. Thank you anyway.Tamarra
The last sentence was essential for me. I had spotted the code review option on top, but having multiple editors side by side, I was struggling to find the list of commits/branches to compare with, which is at the bottom of the screen below all editors.Dogberry
Could someone add a wider-view screenshot? I'm having trouble finding where these button are supposed to be. (I think this whole answer may only apply older XCodes than 15 though.)Bedizen
@Bedizen It's still up to date. Once you selected a file, on the line where there is the file name at the top, it's at the right. On the other answer you commented: https://mcmap.net/q/405046/-where-is-the-xcode-side-by-side-code-comparison-option it's on the top right. Or via Xcode Menu: View/Show Code ReviewConrado
S
9

You can enable it quickly in the menu Editor > Side By Side Comparison.

Editor > Side By Side Comparison

Sorcerer answered 29/3, 2022 at 7:21 Comment(0)
F
4

On XCode 15 I had to do this and then also double click on the file to get it to go into side by side view

enter image description here

Then the double arrows near the top right in screenshot below appeared which allowed me to switch between side by side and single view. The "lines" icon left of this allows me to choose inline or side by side too.

Flatfooted answered 26/9, 2023 at 14:46 Comment(1)
Thanks, I have no idea how you discovered this but great find! Odd that there's no other way than an undiscoverable random gesture to access what used to be the default diff view (and one of the best features of Xcode).Bedizen

© 2022 - 2025 — McMap. All rights reserved.