Xcode code formatter Swift
I\'m trying to auto format my code written in Swift. It\'s necessary if you\'re working in team and using CVS and don\'t want
SwiftFormat is a popular code formatter for swift. It has an extension for Xcode, which can be accessed from the Editor
menu.
Quote from the SwiftFormat readme:
SwiftFormat is a code library and command-line tool for reformatting swift code on macOS or Linux.
SwiftFormat goes above and beyond what you might expect from a code formatter. In addition to adjusting white space it can insert or remove implicit self, remove redundant parentheses, and correct many other deviations from the standard Swift idioms.
I write a extension app about format Swift code: Swimat
There has two way to install
brew cask install swimat
Clone this repo, build and restart Xcode.
See https://github.com/Jintin/Swimat for more information
I would suggest using sublime text with the swift plugin, which will allow you to hotkey the code formatting. https://sublime.wbond.net/packages/Swift