blog

Beautify Your Objective-C Code

by

Uncrustify is an open source code formatting tool for various languages including C, C++ and C#. It can also be used to format Objective-C code.

Uncrustify offers a large number of fine-grained options for code formatting that can be somewhat daunting to set up. The tool I want to mention here is a GUI application written by Ryan Maxwell that provides a neat user interface for setting the options for code formatting for Objective-C code. It is an application called UncrustifyX.

Here is a screenshot of the main window. It is easy to change the setting of an option on the left side and see its effect on the code on the right.

Image
Clicking on the Info button for any option shows more detail about that option as shown here.
Image
This GUI tool provides a way to define the formatting options exactly as you want. These options can then be saved as a configuration file. The command-line version of uncrustify can then use this configuration file to format source files. There is also an Xcode plugin available that modifies the Edit menu of Xcode to offer options for uncrustify.
More information about this tool for Xcode can be found [here](http:/https://bit.ly/3id1sPe/ “here”).

+ more