Sorting Objective C Import Directives

I know I’m a bit obsessive compulsive, but I’m rather fastidious about how I organize #import statements in alphabetical order at the top of my Objective C files.  If I’m creating and maintaining the file myself, it’s not so bad, but when I work on an existing file it’s a lot more work.  Wouldn’t it be cool if I could just run the sort command on the imports?

Automator to the rescue!  By creating a service in Automator, you can create a service that is accessible from Xcode – or any other app for that matter.

Check out this article by Christian Engvall that describes the steps required to make it happen.  Pretty cool!