Find unused Objective-C imports.
What fui does: finds header (
.h) files that are never imported anywhere in your project — i.e. classes that can potentially be deleted entirely.What fui does not do: find
#importstatements within a file that are unused by that file's code. For that, use a tool like Clang's unused-includes warning or AppCode.
gem install fuifui helpfui findThe find command lists all header (.h) files that are not imported anywhere in the project, and exits with the number of such files found.
fui --path=~/source/project/Name findRunning fui with -x (or --ignore-xib-files) will, for example, mark Foo.h as unused when Foo.xib holds a reference to the Foo class and no other references to Foo.h exist.
fui -x --path=~/source/project/Name findRunning fui with -l (or --ignore-local-imports) will, for example, mark Foo.h as unused when Bar.h contains a local (quotation syntax) import of Foo.h (eg. #import Foo.h).
fui -l --path=~/source/project/Name findRunning fui with -g (or --ignore-global-imports) will, for example, mark Foo.h as unused when Bar.h contains a global (bracket syntax) import of Foo.h (eg. #import <Framework/Foo.h>).
fui -g --path=~/source/project/Name findRunning fui with -i (or --ignore-path) will, for example, ignore a Pods folder when searching for headers or referencing files.
fui --path=~/source/project/Name --ignore-path=Pods findRunning fui with -i (or --ignore-path) can ignore multiple folders when searching for headers or referencing files.
fui --path=~/source/project/Name --ignore-path=Pods --ignore-path=Libraries findfui --path=~/source/project/Name delete --perform --promptUse xcfui for integration with Xcode.
There're a few feature requests and known issues. Please contribute! See CONTRIBUTING.
Copyright (c) 2014-2018, Daniel Doubrovkine, Artsy, based on code by Dustin Barker.
This project is licensed under the MIT License.