6 years ago

Linting your Xcode projects with xclint

In this post I’ll talk about a tool that I have recently released xclint, which validates the structure of your Xcode projects, offering insightful warnings about things that might be wrong in the project structure.

Xcode projects are hard to work with, especially when there is a team behind using git. It’s straightforward to mess things up and end up with a project, which Xcode might be able to read and compile, but that internally is not in a good state:

Keeping Xcode projects in a healthy state is very important and unfortunately, there was no tool that helped you validate that. CocoaPods for instance throws a warning when you do pod install, if there are multiple elements with the same identifier.

Since xcproj, opened an API to read any Xcode project, I decided to leverage it to build a command line tool, xclint that we could use to validate the state of our Xcode projects.

Install & Usage

You can install the tool using Homebrew:

brew tap xcodeswift/xclint git@github.com:xcodeswift/xclint.git
brew install xclint

Or run it using Mint 🌱:

mint install xcodeswift/xclint

Its usage is very simple, you just need to pass one parameter, which is the Xcode project that you want to validate:

xclint MyProject.xcodeproj

The screenshot below shows an example of the tool output when there are validation errors:

xclint output when there are warnings

What’s next

The tool currently supports validation of missing references, and attributes that there are things that we’d like to support in future editions:

Moreover, we plan to support CocoaPods, so that you could install the tool using CocoaPods and use the binary from a project build phase.

Feedback

It’s the first version of the tool, 0.1.0 so it’s very likely that you encounter some errors. If so, don’t hesitate to open issues on GitHub with all sort of issues that you found using the tool. Moreover, if you have any idea of things that we could validate or features that we could add to the tool, feel free to open issues or pull requests with your proposals. You’re very welcome!

About Pedro Piñera

I created XcodeProj and Tuist, and co-founded Tuist Cloud. My work is trusted by companies like Adidas, American Express, and Etsy. I enjoy building delightful tools for developers and open-source communities.