格式化 Objective C 源文件
可能的重复:
Objective-C 样式格式化程序
我对 Objective C 代码的格式非常挑剔。最近,我不得不处理相当多不是我编写的 Objective C 代码,我想根据我自己习惯的代码格式标准(例如 ANSI 括号样式、方法名称和第一个之间的间距)对其进行格式化。 。
当然,我知道我可以在 Perl 中组合一些东西来为我实现自动化,但我希望有一个工具可以为我完成这项工作。那么,有没有一些免费的工具可用 用于格式化 Objective C 文件?
Possible Duplicate:
Objective-C style formatter
I'm very picky about the formatting of my Objective C code. Lately I've been obliged to work with quite a bit of Objective C code that wasn't written by me, and I would like to format it according my own customary code formatting standards (e.g. ANSI bracket style, spacing between method name and first argument, etc, etc.
Of course, I know I can throw together something in Perl to automate this for me, but I was hoping there was a tool out there which could do the job for me. So, is there some free tool available for formatting Objective C files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要快速但不完整地格式化(主要是缩进),请选择代码和 Control-I。这与通过粘贴代码获得的格式大致相同。
For quick but not complete formatting (mainly indenting) select the code and control-I. THis is about the same formatting as obtained by pasting code.
好的,找到了 Uncrustify,它可以解决这个问题:
http://uncrustify.sourceforge.net/
和一个示例配置Objective C 文件位于:
http://blog.carbon Five.com/2009/08/07/code-formatting-in-xcode/
甚至还有一个 XCode 插件可用:
https://github.com/benoitsan/BBUncrustifyPlugin-Xcode
OK, found Uncrustify, which does the trick:
http://uncrustify.sourceforge.net/
And a sample config file for Objective C here:
http://blog.carbonfive.com/2009/08/07/code-formatting-in-xcode/
There's even an XCode plugin available:
https://github.com/benoitsan/BBUncrustifyPlugin-Xcode