Remove Unused Methods from xcode ios Remove Unused Methods from xcode ios xcode xcode

Remove Unused Methods from xcode ios


Unfortunately unlike C functions, getting a list of unused objc methods in the form of warnings in Xcode is tricky due to the dynamic runtime environment. Your code might, for example,create a selector from a string and then call that selector on a class or instance of one etc.

One approach I've used, however it's time consuming depending on the size of the class(es), is to open the assistant editor and position the cursor over the method you wish to inspect and select callers (see below image. Normally the default selection is counterparts).

enter image description here

If there are no callers of the method then the editor shows no results.

enter image description here

However if you do this be aware no results will also show for IBActions and overrides in subclasses of iOS frameworks etc. You need to really know the code to determine if 'no results' really means no callers!