Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 976 Bytes

format.md

File metadata and controls

31 lines (22 loc) · 976 Bytes

SweetPad: Format Swift code

This extension integrates swift-format with VSCode for formatting Swift files. You can also enable "Format on Save" to format Swift files automatically when saving.

Swift-format

Installation

To use this feature, first install swift-format using Homebrew:

brew install swift-format

Next, add the following configuration to your settings.json file:

{
  "[swift]": {
    "editor.defaultFormatter": "sweetpad.sweetpad",
    "editor.formatOnSave": true
  }
}

Then, open your Swift file and press ⌘ + S to format it 💅🏼

🙈 In case of errors, open the Command Palette with ⌘ + P and run > SweetPad: Show format logs. This command will open an "Output" panel displaying logs from swift-format. If you encounter issues, grab the logs and open an issue on the SweetPad GitHub repository.