Skip to content

iNono22/X-SwiftFormat

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛠 X-SwiftFormat

Installation

Using Github

Using Cask

brew cask install x-swiftformat

Usage

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 (.swift-format) to use later 🖥

2) Enable X-SwiftFormat

Open System PreferencesExtensionsXcode 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 12 (Swift 5.3), you can check out and build swift-format using the following commands:

git clone -b swift-5.3-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.3-branch
🌱 Resolving package
🌱 Building package
🌱 Installed swift-format swift-5.3-branch
🌱 Linked swift-format swift-5.3-branch to /usr/local/bin

👍👍👍

Command Line Usage

swift-format -v
0.50300.0
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

About

X-SwiftFormat extension for Xcode

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 99.3%
  • Shell 0.7%