1

I prefer something that will work with Xcode 4, but I need a pretty print formatter for Objective-C code on the mac. I have tried Editor > Structure > Re-indent, but nothing happens (I have the code string selected beforehand). I am happy to use that if someone can tell me how to get it to work. The Preferences > Text Editing > Indentation is set to default settings, but I've tried changing these too.

So... I have looked all over but not found a tool to do this simple task for me. Text Wrangler says it will do it, but again nothing happens when I try to format the code.

May certainly be user error, but I need help - I'm tired of hand formatting the code!

nhahtdh
  • 55,989
  • 15
  • 126
  • 162
Mark
  • 1,988
  • 2
  • 24
  • 42

2 Answers2

2

Try Uncrustify tool. Works for me when I've got a bad formatted code =)

Also, have a look at this question.

Community
  • 1
  • 1
Alexander N.
  • 564
  • 3
  • 10
1

Here's an example for Xcode 3. I don't have Xcode 4 so I can't test it there, but hopefully something similar will work. If not, you could create a service with Automator.

Also see these questions:

Community
  • 1
  • 1
Nicholas Riley
  • 43,532
  • 6
  • 101
  • 124
  • Thanks - the article looks promising... I had looked at crustify before but seemed too much pain for something that should be simple! – Mark May 05 '11 at 23:39
  • 1
    Do file a bug on Xcode too. Xcode 4 is just at the beginning of its life, as the first version with real language awareness and it may be something that is causing the reformatter not to behave as designed. – Nicholas Riley May 06 '11 at 01:17