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.