Imp is a tiny yet useful Xcode extension, which allows you to sort import declarations and remove duplicates. Sorting import statements is a good quality coding practice and Imp is here to help you.
Tame the Imp by binding a key in Xcode preferences
Objective-C, Swift
- Basic import sorting
- The class header on top, separated by new line
- Split frameworks and headers imports
- Remove duplicates
- Sorting selected lines
- Cut empty lines among imports
- More flexible settings
If you have an idea for a new feature, please file an issue and tell me more.
Clone and Run the project with Xcode 8+ (make sure the App and the Extension are signed with your developer account)
- Open
Imp.xcodeproj
- Sign both the Application and the Extension using your own developer account
- Product > Archive
- Right click archive > Show in Finder
- Right click archive > Show Package Contents
- Open Products, Applications
- Drag
Imp.app
to your Applications folder - Run
Imp.app
and close it (the app need to be run at least once) - Go to System Preferences -> Extensions and check if
Imp Tools
is enabled in Xcode Source Editor section (orImp
in All section) Imp Tools
should now be available from Xcode's Editor menu- Bind a key for
Sort imports
command - Find a Large Class with many messy imports
- Hit the key and enjoy the magic!
Just run Imp
from your Applications folder. No need in restarting Xcode to apply the changes!
- Disable the extension in System Preferences
- Delete the App from Applications folder
- Feel sorry
Imp doesn’t like messy code and may think that the first @implementation (or @interface, in case no implementation found) he founds is the class you are working with. Xcode doesn’t provide any information on the current file, so little fella has to guess it. It will affect the header which will (or will not) be popped to top with “own header on top” setting.
For any questions or feedbacks, feel free to contact me directly via Telegram: @alexxxander