[swift-evolution] Swift source code formatting tool like clang-format for objective-c

Douglas Gregor dgregor at apple.com
Thu Dec 10 13:24:03 CST 2015


> On Dec 10, 2015, at 11:13 AM, HÃ¥kon Bogen via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I'm a huge fan of clang-format, (http://clang.llvm.org/docs/ClangFormat.html <http://clang.llvm.org/docs/ClangFormat.html>) a tool that can set rules for formatting source code in Objective-C projects. With tools like spacecommander (https://github.com/square/spacecommander <https://github.com/square/spacecommander>) and clang-format for XCode (https://github.com/travisjeffery/ClangFormat-Xcode <https://github.com/travisjeffery/ClangFormat-Xcode>), it can enforce the rules and auto run the formatter constantly so nicely formatted code stays that way. It saves alot of time, and keeps acleaner commit log without constant formatting adjustment. 
> 
> Moving to Swift, it was a dearly missed feature. I actually asked about if Swift would be supported by clang-format on the clang-developers forum after it was announced in 2014, but got no replies. ( http://clang-developers.42468.n3.nabble.com/Will-clang-format-support-the-format-of-Swift-td4039910.html <http://clang-developers.42468.n3.nabble.com/Will-clang-format-support-the-format-of-Swift-td4039910.html> ) 
> 
> Would auto formatting tools for Swift be a good idea to include in the bundle of Swift Components, like clang-format is a part of clang/llvm? 


This would be a fantastic thing to have, but of course someone has to build it ;)

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151210/0b9d6fa4/attachment.html>


More information about the swift-evolution mailing list