2018年3月13日
效果:
image.png
使用说明:https://github.com/mapbox/XcodeClangFormat#building
第一步下载
image.png
第二步打开选择其中一种格式化模式 (也可以自定义)
image.png
或者
image.png
custom.clang-format 文件内容如下【文档:https://www.cnblogs.com/PaulpauL/p/5929753.html】
BasedOnStyle: LLVM
IndentWidth: 4
MaxEmptyLinesToKeep: 4
BreakBeforeBraces: Attach
AllowShortIfStatementsOnASingleLine: true
IndentCaseLabels: true
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ColumnLimit: 0
AlignTrailingComments: true
SpaceAfterCStyleCast: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
第三步 打开偏好设置的扩展,勾选clang-formatimage.png
第四步给xcode应用添加格式化快捷键
image.png
如果您发现本文对你有所帮助,如果您认为其他人也可能受益,请把它分享出去。