Imp đ
February 28, 2018 ¡ View on GitHub
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
Supported languages
Objective-C, Swift
Features
- 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.
Installation
Demo way
Clone and Run the project with Xcode 8+ (make sure the App and the Extension are signed with your developer account)
Right way
- 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.appto your Applications folder - Run
Imp.appand close it (the app need to be run at least once) - Go to System Preferences -> Extensions and check if
Imp Toolsis enabled in Xcode Source Editor section (orImpin All section) Imp Toolsshould now be available from Xcode's Editor menu- Bind a key for
Sort importscommand - Find a Large Class with many messy imports
- Hit the key and enjoy the magic!
Settings
Just run Imp from your Applications folder. No need in restarting Xcode to apply the changes!
How to uninstall
- Disable the extension in System Preferences
- Delete the App from Applications folder
- Feel sorry
Known limitations (objC)
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.
Thank you
For any questions or feedbacks, feel free to contact me directly via Telegram: @alexxxander