The quickest way to find dead code is to use a good IDE. Delete unused code and unneeded files. In the case of an unnecessary class, Inline Class or Collapse Hierarchy can be applied if a subclass or superclass is used. To remove unneeded parameters, use Remove Parameter.
Use http://jeffhodnett.github.io/Unused/ to find the unused images.
The integration steps are very easy; you have to create a new dedicated target, and among its build phases add the command that launches Periphery: periphery scan . Then when you'll run the project Periphery will start scanning the app reporting as many warnings as unused code found.
Since dead code detection is a delicate process that requires absolute certainty of the deadness status, developers should only use a tool specifically designed to read source code to find the unused parts. Project Analyzer is such a tool.
Xcode has a number of settings you can enable to warn you about things like unused functions, parameters, and values.
You can also easily enable strict warnings by setting your Other Warning Flags to -Wall -Wextra -Weverything
.
Another option for detecting unused code is by using Code Coverage.
In left side select Project and in Build Settings
Unused functions, parameters, and values
Other Warning Flags to -Wall -Wextra -Weverything
To check the unused functions and variables you can also use the following scripts-
https://github.com/PaulTaykalo/swift-scripts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With