An Xcode plug-in to format your import headers in a systematic manner. It simply removes duplicates, spaces and sorts them alphabetically making it much more easier to read and avoid duplicate imports. Works with @imports
, #include
, #import
and import
.
Install using Alcatraz.
Alternatively you can also clone this repo, build and run CleanHeaders, restart Xcode.
Press command+|
to format the headers for the currently open file. You can also select a certain segment of the file and do the same.
- Works with includes kept together at the top of the file only.
- If there is a platform specific include such as
#if TARGET_OS_WATCH
the headers would have to be sorted seperately. - Auto save option not available yet.
- Missing tests
I am using some helper functions to deal with the IDE from ClangFormat-Xcode, thanks for the awesome class.