Reputation: 4920
Is there a way in Xcode to find all the places where a method or property has been been called?
In Eclipse, for example, you can right-click a method and select Find references. Is there anything similar in Xcode?
Upvotes: 196
Views: 63115
Reputation: 44351
Place the insertion point in a method invocation or declaration and choose Find > Find Selected Symbol In Project. For multipart selectors this will only highlight the first part but searching does seem to work relatively reliably. You can also use Find Call Hierarchy which highlights the entire line instead.
The corresponding contextual menu item (Find Selected Symbol in Workspace) also works, but it's a bit trickier to make work properly. Make sure no text gets selected otherwise it'll search for the selected word rather than the entire selector. To do so, you can click with the left mouse button prior to clicking with the right mouse button (or Control-clicking) in the same location. There's no such issue with the contextual Find Call Hierarchy.
Upvotes: 7
Reputation: 155125
In pictures...
A couple of notes:
Upvotes: 270
Reputation: 12036
Yes, open the Assistant editor and instead of Counterparts select Callers.
Upvotes: 37
Reputation: 17269
As of XCode 4.5 you can click on "Show find options" within the search field of the Search Navigator. There you can specify "Symbol References"
Upvotes: 18
Reputation: 1
With xcode 4 you can now right click on references and select "jump to definition."
Upvotes: -14