by ruiaureliano

ruiaureliano /X-SwiftFormat

X-SwiftFormat extension for Xcode

530 Stars 10 Forks Last release: 4 months ago (1.0.2) Other 83 Commits 9 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

πŸ›  X-SwiftFormat


  • Download from GitHub


  • Using Homebrew
  brew cask install x-swiftformat


1) Open X-SwiftFormat

X-SwiftFormat works as Xcode Extension to format your swift code. You will need to open this once to activate it πŸ‘

a) You case use the Preview to see the format running in the app 🦾

b) You can export a configuration file (

) to use later πŸ–₯

2) Enable X-SwiftFormat

Open System Preferences β–Έ Extensions β–Έ Xcode Source Editor and make sure X-SwiftFormat is selected βœ…

3) Use X-SwiftFormat

Open Xcode and use the Format Swift Code command in Xcode's Editor menu πŸš€

4) Add X-SwiftFormat Shortcut

Open System Preferences, click on Keyboard and switch to the Shortcuts tab. Select App Shortcuts, then hit the + button. Select Xcode, enter

Format Swift Code
and set your Shortcut.πŸ‘

Installing Apple Swift Format (Xcode or Mint)

a) Using Xcode

if you are using Xcode 11.4 (Swift 5.2), you can check out and build swift-format using the following commands:

git clone -b swift-5.2-branch https://github.com/apple/swift-format.git
cd swift-format
swift build

You should see this

[207/207] Linking swift-format

b) Using Mint

If you dint have Homebrew, install here

brew install mint
mint install apple/[email protected]

You should see this

🌱 Cloning swift-format swift-5.2-branch
🌱 Resolving package
🌱 Building package
🌱 Installed swift-format swift-5.2-branch
🌱 Linked swift-format swift-5.2-branch to /usr/local/bin

Command Line Usage

swift-format -v

|Command | Description | |-|-| |

swift-format swift
|Display formatted code| |
swift-format -i file.swift
|Overwrites formatted code| |
swift-format -r folder
|Format all files in a folder| |
swift-format -r -i folder
|Format all files in a folder and overwrites|

Check more info here: https://github.com/apple/swift-format

I'm Rui Aureliano, iOS and macOS Engineer at OlΓ‘ Brothers. We make Sip πŸ€“

Linkedin | AngelList | Twitter | Github | Medium | Stackoverflow

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.