ClangFormat

ClangFormat automatically formats code according to a given set of code formatting rules.

Xcode 8 removed the ability to add third-party plugins, but added editor extensions. There's at least one plugin available to add this functionality, but Xcode 8 is still in beta and we haven't tested that extension yet, so proceed with caution.

Xcode 7

The easiest way to use ClangFormat is to install the Xcode plugin. This can be installed through Alcatraz.

This plugin adds a Clang Format submenu under Edit, from which you can automatically format the current file, files selected in the sidebar, and so on. It also offers multiple formatting options, including the LLVM, Google, and Mozilla formatting standards.

To use the plugin:

Our .clang-format file is based on the LLVM coding standard, with some tweaks. This could probably use further customization, but it's a good start.

Vokal Limitations