How can you find all references to a Swift class variable in Xcode?
The answers I've seen (such as the selected answer of Finding all references of a variable or a method in Xcode4) are only applicable to Objective C.
How can you find all references to a Swift class variable in Xcode?
The answers I've seen (such as the selected answer of Finding all references of a variable or a method in Xcode4) are only applicable to Objective C.
Control-click on the symbol and click Find > Find Selected Symbol in Workspace.
Xcode is not very strong when it comes to code analysis. You are however left with 2 options:
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.
Use another IDE that has code analysis capabilities such as AppCode from JetBrains. Besides an intelligent search it also comes with clever refactoring facilities.
In Xcode you can find references of the variable Find >References >Matching in Find Navigator in Left Navigator But be careful it will give you all the references matching the variable name so you must to be careful with that, until now this feature not implemented in a good way to find the references like other IDE's.
This is the most efficient way you can do until now.