Swift Formatter

Indent Swift code and tidy its spacing.

Swift Formatter

.swift

Paste text or open a file to see the result.

What it does

Indents Swift code and evens out spacing around braces, colons and operators. Handy for snippets copied from documentation or chats before you paste them into a project. You get the same code, laid out cleanly.

About the .swift format

.SWIFT file extension
File Type
Apple Swift Programming Language Source Code
Developer
Apple, Inc.

The file extension .SWIFT is for a special type of file that can be opened and edited with Apple Swift Programming Language.

Swift Formatter questions

How do I use the Swift Formatter?

Paste the text into the Input box or open a file, set the options, then copy or download the result.

Does renaming a file to .swift change its format?

No. The extension only tells programs what to expect, and the content of the file stays the same. To change the format, convert the file. The .swift page lists programs and converters for it.