I am searching for a plugin to auto format objective-c code within XCode, it would also be very helpful to have a set of optional styling formats,
I'm aiming to follow Google's code convention: http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml as a start, any help is appreciated.
XCode has a code formatter built in - it's a little basic but can re-indent your code. First set your indentation preferences in Xcode (as mouviciel suggests). Then select the source you want to reintend and choose Edit | Format | Re-indent.
If you want to go further, Hackertoys has instructions for adding uncrustify support to Xcode. I have not tried this.
After tinkering with multiple external formatters and the weak internal xcode formatter, I finally settled with uncrustify. Uncrustify has fairly good Objective-C support, can easily be integrated with xcode as a user script, and provides a centralized formatter for pretty much all languages that xcode natively supports.
The biggest hurdle with xcode is the daunting configuration file. My recommendation, take one of the supplied sample configs (ben2.cfg is very good), merge in the objc.cfg sample, and tweak as necessary.
updated April 2013
As Roger Nolan and rcw3 suggested, you can go a lot further with Uncrustify. The latest release version can be download here.
Integration Into Xcode
Integration into Xcode is dependent upon the version of Xcode that is installed.
Benoît Bourdon's BBUncrustifyPlugin-Xcode
This plugin provides access to Uncrustify right from Xcode's "Edit" menu ("Uncrustify Selected Files", "Uncrustify Active File", and "Uncrustify Selected Lines"). Just build the project and the plugin is compiled and installed.
As of April 2, 2013, Uncrustify 0.60 and an Uncrustify configuration file are include with the plugin. To use a custom Uncrustify configuration file, make sure to read the section titled "How to customize the Uncrustify configuration?" of README.md.
Note: To use Uncrustify from the command line, for example as part of a git hook, I recommend building and installing Uncrustify independently. For consistency sake, I also recommend replacing the version of Uncrustify that comes with the plugin with a link to the version Uncrustify that was independently built and installed. The following is how to do that:
Jonah Williams' Code Formatting in Xcode 4
Jonah Williams' Code Formatting in Xcode
Example Uncrustify Configuration File
The Uncrustify 0.60 configuration file that I use for Objective-C is located here.
Update the Uncrustify Configuration File for a New Version of Uncrustify
To update the Uncrustify configuration file for a new version of Uncrustify, start a Terminal and type:
To see the changes made to the Uncrustify configuration, in the terminal type:
To View a Documented Version of the Uncrustify Configuration File
To view a documented version of the Uncrustify configuration file, start a Terminal and type:
AppCode from Jetbrains has a very good code formatter. For my taste uncrustify feels much too hacky.
Reportedly, bcpp works just fine on obj-c, and it has a TextMate plugin, too.
A partial answer is that some little things can be set from within Xcode, as 2-space indents. See Indentation Preferences in Xcode Workspace Guide.