Search code examples
referencexcode4

Finding all references of a variable or a method in Xcode4


There'a a similar question here but I couldn't make use of the answers in XCode 4. I googled it but I couldn't come up with anything useful either. What's your effective method of getting this information?


Solution

  • Find in project, though if you are searching to change the name everywhere, better would be to use the Refactoring menu.

    EDIT: You can use Refactoring to find where a specific variable is referenced. Select the variable and choose Edit->Refactor->Rename. In the refactoring screen, rename the variable (just add _ at the end or something) and click preview. it will show everywhere in the project that variable is referenced. Click on each file to see the lines where the variable is called. After you're done just cancel the refactor.