If you have a method, e.g., loadMediaImages
in a .h
file, how do you find all references to that method in the project? In Visual Studio there is a "Find All References" option on the content menu when you highlight and click the method name. Anything similar in Xcode?

- 29,441
- 10
- 93
- 100

- 9,796
- 21
- 77
- 121
-
From the answers it seems this functionality does not exist in XCode 4. I have submitted an Enhancement request to Apple support. – ChrisP Jul 19 '11 at 18:27
-
This is an exact duplicate of [Find method references in Xcode](http://stackoverflow.com/questions/7145045/find-method-references-in-xcode), and though this one was posted first, the other has received more views and better answers so this one should probably be closed (though +1 anyway). Note that, despite the title, the question (and my answer) include properties. – Mark Amery Jun 02 '14 at 18:48
6 Answers
Using the "Search Navigator" it's possible to search for symbol references within a project or workspace. Click on the little magnifying glass icon in the search box to "Show Find Options", and then select the Style: Symbol References.
Note: This is in Xcode 4.6, but may have been present in earlier versions.

- 6,096
- 4
- 31
- 32
I was looking for similar option. I do not know why Xcode did not included that. But there is a work around I use until Apple give that option in Xcode.
Try this in the source code (.m) file,
Select the symbol, right click -> Refactor -> Rename
-> Give a name whatever you wish, then press Preview.
Now you can see all the references. You can Cancel
/do not rename it. :)
Or press Cmd + Shift + F
, and choose optons Find > References > Matching or Containing. But it will search all text with similar name. Not elegant like Refactoring.

- 15,408
- 7
- 58
- 96
Find selected symbol in workspace is what you need
- right click on the method/property -> Find -> Find selected symbol in workspace
- focus the property/method and press ⇧ + ⌃ + ⌘ + F (or you can have a custom one)
Does basically the same search as Refactor -> Rename does

- 217
- 3
- 11
Haven't seen this in Xcode. Just FYI you are able to do that with AppCode though.

- 29,441
- 10
- 93
- 100

- 22,616
- 10
- 116
- 130
You could do a search in the whole project... I don't have a screen ready but I know Xcode can.

- 29,441
- 10
- 93
- 100
-
A contextual reference search is quite different to a simple text search, hence not practical when you have a method/property with a very common name like for example `initialize()` – Petru Lutenco May 06 '22 at 14:08
If I'm not mistaken, Xcode 4 (not sure about previous versions) does not support a Find All References search. You can perform a text search within the entire project by pressing Shift+Cmd+F (Find in Workspace in the Edit menu), but this does not find exact "references", just matching text. You're best bet is using the Refactoring menu, as talked about in Finding all references of a variable or a method in Xcode4, but it is not very clean and requires more work than it should.

- 1
- 1

- 54,662
- 15
- 117
- 144