Logo 61e73bc61c0e1780102320e879dc3cac0e29303ea8894dd8f10c942f3ba8120f

otters.io

An adorable little blog

Swift Format Tool

Sunday — April 17th, 2016

In case you haven't kept an eye on the inside baseball of Swift language development, John Holdsworth has made a Swift format tool. It replaces the old method of handling indentation and format in SourceKit.

You know SourceKit Right? Of course, you do! How could you not know and love this cute little fella?

SourceKit Crash

What does all of this mean? There might be an opportunity for less SourceKit crashes when Xcode tries to format Swift files. More importantly, this is a great place to start with a standard Swift Style. Think ClangFormat for Swift.

The new format tool will be based on libIde which is open-source and cross-platform. Linux weirdos might recognize libIde as part of Gnome Builder. This would allow formatting Swift code from the command line and could act as a standard way for other IDE's and editors to format Swift code.

Apple has rough guidelines for style but an automated tool that enforces the blessed style would remove ambiguity. Because no one benefits from petty fights over style.

Stop and think about this for a second. An Apple employee is working on a cross-platform tool that would help developers use an IDE other than Xcode. They put up a pull request on Github. All to resolve a bug that anyone can up-vote on JIRA. All out in the open.

Now we just need Xcode refactoring tools for Swift.

Refactor