Is any way to autoformat a source code in the Xcode IDE?
Yes Xcode 4 has an autoformat feature.
Try following:
Please also see here: Fix code indentation in Xcode