How to use code formatter in Xcode for Swift?

后端 未结 9 668
Happy的楠姐
Happy的楠姐 2021-01-31 07:25

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

9条回答
  •  粉色の甜心
    2021-01-31 08:07

    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.

提交回复
热议问题