I love the "Organize Imports" command in Eclipse to implicitly add and remove classes imported into a source file (as in Java or ActionScript).
Is there a command in Xcode to update the #import
directives at the top of.m Objective-C files based on the classes referenced within the file?
1. Click on the View menu in Finder and select Clean up to make all icons align properly. 2. If you want your desktop icons to be auto-arranged, you can do so by clicking on the View menu and then hold on the ALT key on the keyboard until you see the "Keep Arranged By" option show up on the View menu.
You can do this by creating an Automator action and use that in Xcode as well as everywhere in Mac OS X. To do that, do the following:
sort | uniq
as the script and check the "output replaces selected text" checkboxAfter you saved it, you can just select your imports in Xcode, right click and choose your "sort & unique" action to organize your imports.
This is not as good as the organize import actions in Eclipse or IntelliJ, because it doesn't removes unused stuff etc. but it's better than nothing.
PS: Got that from WWDC 2012 Sessions - Session 402 Working Effeciently with Xcode (starting at 6:15)
EDIT
I started using AppCode, the Objective-C IDE from JetBrains, and it has features like "organise imports". You should check it out: http://www.jetbrains.com/objc/.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With