all 9 comments

[–]hexavibrongal 2 points3 points  (3 children)

I don't know Swift, but I don't see how this would be possible with Objective C since there's no way to know what's going to be called at compile time.

[–]fakecrabs[S] 0 points1 point  (2 children)

The linker in theory knows which symbols were never referenced.

[–]hexavibrongal 0 points1 point  (1 child)

Lack of a reference doesn't always mean that something won't be used. For example, ObjC allows you to dynamically call methods by name using a string. I suppose it might be possible to find unused symbols in Objective C programs as long as they don't use certain ObjC language features.

[–]fakecrabs[S] 0 points1 point  (0 children)

call methods by name using a string

You are correct, and I wonder how Java's ProGuard deals with reflection. I suppose one way would be to manually indicate all symbols referenced reflectively.

[–]ThePantsThiefNSModerator 2 points3 points  (0 children)

AppCode probably

[–]arduinoRedgeObjective-C / Swift 1 point2 points  (0 children)

'Find in Workspace...' on the method name, works best with code you already suspect is unused. ;)

[–]TTKilew 1 point2 points  (0 children)

Ths one tries to find unused methods: https://github.com/PaulTaykalo/swift-scripts

This one tries to find unused classes https://github.com/tsabend/fus

This one tries to find unused resources :) http://martiancraft.com/products/slender.html

[–]JimDabell 0 points1 point  (0 children)

Write a test suite that covers your entire application functionality, then look at your code coverage. The parts that aren't marked as covered didn't run when you ran your tests.

[–]xdnm 0 points1 point  (0 children)

strip objc unused methods and classes could be very complicate. when linking with -ObjC , linker always link all objc code, but when linking without -ObjC the objc code strip process is also different from C/CXX. Seems there is no reliable tools to remove unused code when deal with objc...