Xcode - Find references to Swift variable

Xcode is not very strong when it comes to code analysis. You are however left with 2 options:

  1. Rename the variable definition temporarily and compile the project. All usages of the variable won't find it anymore and provoke an error – hence every compile error is a usage of your variable. By selecting the error you navigate to the variable usage.

  2. Use another IDE that has code analysis capabilities such as AppCode from JetBrains. Besides an intelligent search it also comes with clever refactoring facilities.


Control-click on the symbol and click Find > Find Selected Symbol in Workspace.

Tags:

Xcode

Swift