问题
This question already has an answer here:
- Code Formatting In Xcode 10 answers
I wonder how can I format my code to align it neatly? Does it have a feature similar to Eclipse's ctrlshiftf?
回答1:
Select first the text you want to format and then press Ctrl+I.
Use Cmd+A first if you wish to format all text in the selected file.
Note: this procedure only re-indents the lines, it does not do any advanced formatting.
回答2:
Key combination to format all text on open file:
Cmd ⌘ A + Ctrl I
回答3:
Select the block of code that you want indented.
Right-click (or, on Mac, Ctrl-click).
Structure → Re-indent
回答4:
I would suggest taking a look JetBrains AppCode IDE. It has a Reformat Code command. I have come from a C# background and used Visual Studio with Jetbrains Resharper plugin, so learning AppCode has been a pleasure because many of the features in Resharper also exist in AppCode!
Theres too many features to list here but could well be worth checking out
- http://www.jetbrains.com/objc/features/index.html
- http://www.jetbrains.com/objc/
来源:https://stackoverflow.com/questions/6543026/how-to-format-code-in-xcode