XCFormat includes an Xcode Source Editor
Extension, allows you to format your code by using uncrustify, currently not support Swift.
To enable this extension, you need to run XCFormat once, then go to "System Preferences - Extensions - Xcode Source Editor", then enable "XCFormat".
To edit the format rules, you can run the app, then click "EDIT" to show the configuration file.
To understand how to config the rules, you can read "config-doc.txt".
Use third party apps, like UncrustifyX, to simplify the editing of configuration.