Streamlining Xcode with tools and tips — Part 1
This is my first article in Medium and I am an Android / Flutter developer. Coming from the Flutter world, I missed so many things when developing apps using Swift. This article will cover how can we get those good things from my Flutter (VSCode) ecosystem to Xcode.
Formatting:
Yes, Xcode has a re-indent option. But, you know how easy it is to just tap Cmd + S and get a nicely formatted code. For that i came across SwiftFormat which suits our exact need.
To setup SwiftFormat:
- Install using Homebrew (recommended)
brew install --cask swiftformat-for-xcode
- Once done open the SwiftFormat for Xcode application and close it.
Next, go to System Settings -> Extensions -> Privacy and security -> Extensions -> Xcode Source Editor and enable SwiftFormat.
Now again, open System Settings and go to Keyboard ➔ Keyboard Shortcuts ➔ App Shortcuts. Then click on the + sign and select Xcode. The Menu Title should be exactly Editor->SwiftFormat->Format File and for the Keyboard Shortcut press CMD+S, then click Done.
Click Done and Open any Swift File and press Cmd + S 🎉