PrettySwift is a Xcode Source Editor Extension that formats and lints your Swift code. It uses swift-format
to format or lint and takes a zero-configuration approach.
To install PrettySwift for Xcode, download it from the Mac App Store. Then, open the app and follow the instructions.
To format your code, open a Swift file you want to format and choose Editor > PrettySwift > Format
from the menu bar.
To lint your code, open a Swift file you want to lint and choose Editor > PrettySwift > Lint
from the menu bar.
If you want to use a keyboard shortcut to format your code, you can add one in System Settings > Keyboard > Keyboard Shortcuts > App Shortcuts
. Click the +
button, choose Xcode
as the application, type Editor->PrettySwift->Format
as the menu title, and then choose a keyboard shortcut like ⌘S
.