69

In previous Xcode version , I could jump to definition with simple Cmd + click on that method/variable . But in Xcode 9, I feel uncomfortable to jump to definition .

Does anyone has a better solution for jumping to definition in Xcode 9 ?

I am tired of selecting options from dropdown list.

Machavity
  • 30,841
  • 27
  • 92
  • 100
Bikram Thapa
  • 1,329
  • 1
  • 16
  • 29

12 Answers12

173

Ashish and Ghulam's answers were great but it still kinda bugged me that things had changed and I couldn't jump to definition as before. Then I found this...

Xcode9Beta2-Preferences->Navigation->Command-click on Code:->Jump To Definition:

Xcode9Beta2-Preferences->Navigation->Command-click on Code:->Jump To Definition

iehrlich
  • 3,572
  • 4
  • 34
  • 43
user8315745
  • 1,876
  • 1
  • 8
  • 3
  • 2
    This answer is good. I changed it to the old way. I have been using CMD+Left Click for decades. – Joe Huang Sep 20 '17 at 08:06
  • 2
    Also, keep in mind that `right mouse click` is identical to `control+click`, so now you can `select code structure` (show context menu) by pressing `cmd + right mouse click`. – DanSkeel Oct 31 '17 at 12:22
  • 3
    And to go back to where you came from: ctrl-cmd-left arrow – Yohst Feb 02 '18 at 19:50
31

Solution 1:

  • Go to Xcode menu
  • Click on Preferences
  • Select Navigation Tab from Top
  • Select Command-click on Code
  • Change to "Jumps to Definition"

As you can see in this screenshot

Solution 2: Use

Ctrl + ⌘ + Left click

Ghulam Rasool
  • 3,996
  • 2
  • 27
  • 40
24

There is short cut displayed on drop down menu, just use-

1. Control, Command and left mouse button

OR

2. Command plus Right Mouse Click

instead of command left mouse button.

dip
  • 3,548
  • 3
  • 24
  • 36
  • 2
    Command-right-click seems to be what I wanted. It's dumb that they changed it -- I never want any of the stuff in the popup menu. – David S. Sep 26 '17 at 14:55
  • My issue with command+control+left click is that it's extremely inconvenient for a left-handed person, since control is only on the left side of the MBP keyboard. In such light, it seems not well thought-out to make this the default after so long. – particleman Oct 01 '17 at 23:40
20

In Xcode 9 Beta, you can go definition by Cmd + Right Click

Paresh Patel
  • 380
  • 4
  • 14
7

Standard hot key for jump to definition is ctrl+cmd+j. Set cursor to the class/method you are interested in and press this buttons to switch to declaration. Also you can try to press ctrl+opt+cmd+j. In this case definition will be opened in assistant editor

Alex
  • 1,155
  • 1
  • 8
  • 12
6

If dont like to use mouse click(I certainly don't like) you could use

Command + Ctrl + J

CodeNoob
  • 171
  • 1
  • 8
5

In Xcode 9 both of these work:

⌘ + Right Click

OR

⌘⌃ + Click

Shaked Sayag
  • 5,712
  • 2
  • 31
  • 38
4

When I ⌘-click on a symbol in Xcode 9 I see

enter image description here

That means you have to ⌃⌘-click on the symbol to skip the popup.


Nevertheless there is even a keyboard shortcut:

enter image description here

vadian
  • 274,689
  • 30
  • 353
  • 361
4

I don't know how Cmd + Option + Left Click worked for you guys, but the shortcut (at least for me) was Cmd + Ctrl + Left Click. I've tried on both Apple keyboard and MacBook keyboard and this is the one that did it.

2

In Xcode 9 Beta, it has been changed to Cmd + Ctrl + Left Click.

Ashish Verma
  • 1,776
  • 1
  • 16
  • 27
2

Solution to your question: Ctrl + ⌘ + Left click

Xcode >> Preference >> Key Bindings >> Here is list of all short cuts of Xcode.


enter image description here

Krunal
  • 77,632
  • 48
  • 245
  • 261
0

Deleting everything under the Derived data and re-opening Xcode fixed everything for me.