How to Use SwiftFormat with SweetPad
SweetPad is a VS Code extension for Swift/iOS development, with swift-format
formatting built in. However, I prefer using SwiftFormat
by Nick Lockwood for its comprehensive formatting options.
To use SwiftFormat with SweetPad, update the formatter path and remove the default --in-place
argument in VS Code settings:
Here's my settings.json
:
{
"[swift]": {
"editor.formatOnSave": true,
"files.autoSaveWorkspaceFilesOnly": true,
"editor.defaultFormatter": "sweetpad.sweetpad"
},
"sweetpad.format.args": [
"${file}"
],
"sweetpad.format.path": "swiftformat"
}