Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting unused methods iOS

Tags:

xcode

ios

Very simple question and hopefully isn't duplicated :).

The situation is following:

Project has been developing more then a year and by many developers.
From time to time I'm facing with unused methods (which are defined in .h and .m) obviously I'm not getting any warnings.

This is not critical, but I would like to have project cleared from all unnecessary staff. Of course I can search for all methods and define which are unused in project but I wonder if there is more elegant way?!

Thanks

like image 452
Injectios Avatar asked Jul 14 '14 12:07

Injectios


2 Answers

A quick way to check while browsing your source code is the View > Standard Editor > Show Related Items menu (shortcut key: ^1). Place your cursor within a method body and then view the Callers.

enter image description here

like image 126
azsromej Avatar answered Sep 23 '22 11:09

azsromej


AppCode (http://www.jetbrains.com/objc) can tell you if a method or an import is unused. It's works in real time, but you can also inspect a whole project (menu code > inspect Code)

enter image description here

I don't think xCode can do it. AppCode is not free, but it has a trial version.

like image 21
EricD Avatar answered Sep 22 '22 11:09

EricD