0

Possible Duplicate:
Objective-C style formatter

I'm very picky about the formatting of my Objective C code. Lately I've been obliged to work with quite a bit of Objective C code that wasn't written by me, and I would like to format it according my own customary code formatting standards (e.g. ANSI bracket style, spacing between method name and first argument, etc, etc.

Of course, I know I can throw together something in Perl to automate this for me, but I was hoping there was a tool out there which could do the job for me. So, is there some free tool available for formatting Objective C files?

Community
  • 1
  • 1
svth
  • 1,303
  • 1
  • 14
  • 23

2 Answers2

1

For quick but not complete formatting (mainly indenting) select the code and control-I. THis is about the same formatting as obtained by pasting code.

zaph
  • 111,848
  • 21
  • 189
  • 228
  • I know I can manually change the file formatting. I'd like to automate it, since I'm obviously not going to go through dozens of implementation files fixing them manually like this. – svth Jan 11 '12 at 00:37
1

OK, found Uncrustify, which does the trick:

http://uncrustify.sourceforge.net/

And a sample config file for Objective C here:

http://blog.carbonfive.com/2009/08/07/code-formatting-in-xcode/

There's even an XCode plugin available:

https://github.com/benoitsan/BBUncrustifyPlugin-Xcode

svth
  • 1,303
  • 1
  • 14
  • 23