

Periphery implementation is based on SourceKit framework that helps finding the references between declarations. Periphery will start a guided setup, resulting in printing out the full scan command and executing one.
#Appcode vs xcode 2021 install#
You can install one easily via homebrew: brew tap peripheryapp/peripheryĪfter installation is complete, run the following command: periphery scan Periphery is an open-source tool written in Swift that aims to find unused declarations in your code. Removing unused declarations with Periphery So, it makes sense to verify the script’s output before doing a cleanup. Unfortunately, you might get lots of false-positive results because the script just performs text search under the hood. You can follow this list to remove unused code from your project. You can install it by cloning the repository and run via command line from the project’s directory: cd Īs a result of running the script you will get a list of items: Swift-scripts is an open-source repository available on Github that comes with a script written in Ruby. Cleaning up unused code with Swift-scripts This way you can get a warning about some of the unused declarations in your code. It might be useful to turn on compiler warning flags like -Wunused-variable, -Wunused-label, etc. You can adjust AppCode introspection options via application preferences.


It can help you find unused import directives as well. AppCode works better with Objective-C code, detecting automatically unused code and suggesting the “Safe delete” quick-fix. Unfortunately, both IDEs don’t provide that many options to find unreachable code written in Swift. Xcode and AppCode are designed to be a default tool that helps you keep your code accurate and clean. In this article I’ll go over a few tools which you can use to clean up your project:įinding unused code with Xcode and AppCode
#Appcode vs xcode 2021 how to#
Therefore, it’s useful to know how to find and remove unused code from your project. Apart from cluttering the project, it might have an impact on a project’s build time by slowing it down. On Swift Wings All posts Tags About Unused code cleanup in iOS projectsĪs your project evolves there might appear unreachable code that is not used anymore or will never be reached.
