Reference: http://blog.csdn.net/zhangao0086/article/details/42872263
Recently, I took over the project of colleagues, found that the project after a lot of hands, each of the code format style and a little difference led to the code display is messy, Google, found that there is an iOS code format plug-in Clang-format, quite to the force.
Configure Clangformat
Although the Clangformat itself has some standardized code formatting schemes built in, it can be customized as well, and we've adopted a custom approach.
Specifically, create a ". Clang-format" file in the project directory or in the workspace directory
. Clang-format is just a configuration file that can be copied anywhere. You can copy it to the root of your project, or you can copy it to the root directory of all your projects.
Configuration parameters:
# base Style
Basedonstyle:llvm
# Indent Width
Indentwidth:4
# line wrapping for parentheses
Breakbeforebraces:attach
# support for one-line if
Allowshortifstatementsonasingleline:true
# switch Case Indentation
Indentcaselabels:true
# The indent width of the block for OC
Objcblockindentwidth:4
# for OC, add a space after the attribute name
Objcspaceafterproperty:true
# The length of each line of characters
columnlimit:0
# Justification of comments
Aligntrailingcomments:true
# Add a space after parentheses
Spaceaftercstylecast:true
# do not add spaces in parentheses
Spacesinparentheses:false
# do not add spaces in brackets
Spacesinsquarebrackets:false
IOS Code Formatting Plugin Clang-format