9

In Xcode, you can control-click on a function definition, and choose "Find Call Hierarchy" from the context menu. This shows all the callers of that function, in the left side navigation area.

This also works for properties, but it it only shows calls to the getter. Is there a way to see calls to the setter?

Selecting the menu item caused Xcode to write Foo.setter:bar in the search field. I tried replacing getter with setter, and it didn't seem to work. (Actually, it seems to have triggered a bug in a Xcode. A process called com.apple.dt.SKAgent is now chewing huge amounts of CPU and has to be killed.)

enter image description here

enter image description here

Rob N
  • 15,024
  • 17
  • 92
  • 165
  • 3
    First, try Xcode 10 in case things are better. `setter` is definitely slow but it does end on my machine. However, it ends wrong (that is, it doesn't list any calls). Having done that, please file a bug with Apple. – matt Aug 09 '18 at 16:07

1 Answers1

0

This has changed in Xcode 11 (checked in version 11.4.1). Now using either "Find Call Hierarchy" or "Find Selected Symbol in Workplace" context menu command finds usages of all getters and setters of the property. There doesn't seem to be a way to find either only getter or setter at the moment.

Yuriy Pavlyshak
  • 327
  • 2
  • 6