Using command-line tools to automate Xcode projects

As part of looking into ways to improve my experience with Xcode, I came across a great talk by Stefano Mondino from Swift Heroes 2020.

The main concept behind the talk was to use various command-line tools to automate an Xcode project.

Firstly, how you can maintain an environment with things like a Makefile, Gemfile, Brewfile, etc. Then various other tools for more specific Swift/Xcode enhancements.

  • XcodeGen to manage the Xcode project, dependencies, targets, to link frameworks, etc.
  • SwiftGen to generate Swift code to map to project resources, such as images, colours, string, etc.
  • SwiftFormat to automate reformatting Swift code to follow a certain style.
  • SwiftLint to further enforce a style and conventions. (Which can be represented in Xcode as you code)

I use SwiftFormat and SwiftLint already. However, XcodeGen and SwiftGen are completely new to me. So I’ll definitely be playing around with these for a while!