Is any way to autoformat a source code in the Xcode IDE?
+1
A:
There isn't really an autoformat option in Xcode.
There is an option to re-indent the code, which will re-align the code according to the tab width set in your preferences, but that's about as far as it goes.
You might have better luck with a text editor like TextMate? I don't know for certain, but I know it supports Objective-C and has some macros, there may be a reformat option?
Jasarien
2010-02-11 09:18:53
Thanks! Re-intent is what I need.
sashaeve
2010-02-11 09:22:24
For more control of the code formatting, you can try uncrustify: http://uncrustify.sourceforge.net/
Rob Keniger
2010-02-11 09:31:59
This should have been a comment (and, with your rep a vote to close as Exact Duplicate).
dmckee
2010-02-14 03:23:54
+1
A:
One trick is to select the code (either "select all" or just the section you want to re-format) - then cut, then paste it back. This triggers the automatic code formatting in the Xcode editor.
Paul R
2010-02-11 10:29:32