问题
I am using Xcode, and noticed that Xcode's default auto creation and completion of functions makes opening curly braces go into new lines. For example
(void) this_is_what_xcode_does
{
// Opening braces on a line of its own - default format
}
I do not like that, I would like the opening braces to be on the same line as the function name. Just like below
(void) this_is_what_i_want_xcode_to_do {
// Opening braces on the same line as the function - my preferred format
}
How can I change the default Xcode format/behaviour?
Thanks.
回答1:
By default Xcode is missing a good, customisable code formatting settings. You can find some external plugins that are mentioned here. Personally I haven't tried them. So in short, Xcode is missing that feature.
As a side tip I can mention that AppCode has a quite good way to format code in the way you want and the keyboard shortcuts for auto formatting code and optimising imports.
来源:https://stackoverflow.com/questions/25942904/default-opening-curly-braces-in-xcode