Skip to content

Instantly share code, notes, and snippets.

@tonycoco
Last active October 11, 2025 04:53
Show Gist options
  • Save tonycoco/eb0280ef920d358d7adf70d5c081289d to your computer and use it in GitHub Desktop.
Save tonycoco/eb0280ef920d358d7adf70d5c081289d to your computer and use it in GitHub Desktop.
Xcode 26 Format and Save using swift-format

Format and Save in Xcode

If you want to use a keyboard shortcut to format your code on save, you can add one in System Settings > Keyboard > Keyboard Shortcuts... > App Shortcuts. Click the + button, choose Xcode as the application, type: Editor->Structure->Format File with ‘swift-format’ as the menu title, and then choose a keyboard shortcut like ⌘S by simply pressing the command+S keys.

Note

This should work for Xcode 16 and higher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment